Skip to content

Instantly share code, notes, and snippets.

@aboekhoff
Created May 15, 2010 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aboekhoff/402394 to your computer and use it in GitHub Desktop.
Save aboekhoff/402394 to your computer and use it in GitHub Desktop.
;; pointless ml-style syntax
;; (now just need a parser combinator to add incanter's infix math and were in business)
(defmacro mlet [& xs]
(let [[[n & args] l2] (split-with #(not= '= %) xs)
[l2 l3] (split-with #(not= 'in %) l2)]
`(let [~n (fn ~n [~@args] ~(rest l2))] ~(rest l3))))
(comment
(mlet f x = * x x in
mlet g x = + x x in
-> 42 g f)
=> 7056)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment