Skip to content

Function application

David Nolen edited this page Jun 20, 2013 · 4 revisions

When writing compilers pattern matching is incredibly useful. Dan & Will both recommend supporting function application.

(defn ->ast [expr]
  (match [expr]
    [['if (test :app ->ast) (then :app ->ast) (else :app ->ast)]]
    {:op :if :test test :then then :else else}))
Clone this wiki locally