Arc Forumnew | comments | leaders | submitlogin
2 points by sjs 4432 days ago | link | parent

You just do your own separation of logic & design, using Arc as the template language. I know it sounds PHP-esque but in practice it seems rather elegant so far.


  ;; the controller-ish part
  (defop problems req
    (display-probs (get-user req)))

  ;; the view-ish fn
  (def display-probs (u)
    (mypage  ; a layout-ish macro
      (each id (keys probs*) (display-prob u (probs* id)))))

  ;; a partial-ish fn
  (def display-prob (u p)
    (tag (div class "prob")
      (tag (span class "pid")  (pr (p 'id) "."))
      (tag (span class "text") (pr (p 'text)))
      (tag (div class "links")
           (let bar* " • "
               (link "details"
                     (string "http://someurl/foo?bar=1&id=" (p 'id)))
               (link "solve" (newsolnlink (p 'id)))
               (link "solutions" (solnlink 'p (p 'id))))))))