-
Notifications
You must be signed in to change notification settings - Fork 64
Function application
David Nolen edited this page Jun 24, 2013
·
4 revisions
When writing compilers pattern matching is incredibly useful. Dan & Will both recommend supporting function application.
(defn parse [expr]
(match [expr]
[['if (test :> parse) (then :> parse) (else :> parse)]]
{:op :if :test test :then then :else else}))
A match-syntax
macro could probably be a lot cleaner:
(defn parse [expr]
(match-syntax expr
(if ~(test :> parse) ~(then :> parse) ~(else :> parse))
{:op :if :test test :then then :else else}))