Created
August 10, 2012 03:51
-
-
Save gfredericks/3310866 to your computer and use it in GitHub Desktop.
amalloy-fn implementable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Special forms supported are if and let* | |
(defmacro amalloy-fn | |
[args expr] | |
(let [[lettings new-expr] | |
(currj.independence/refactor | |
(clojure.walk/macroexpand-all expr) | |
args)] | |
`(let [~@(apply concat lettings)] | |
(fn ~args ~new-expr)))) | |
(macroexpand-1 '(amalloy-fn [x y] | |
(+ x | |
(- 13 (* 2 3)) | |
(/ y (* 2 Math/PI))))) | |
;; (clojure.core/let | |
;; [G__3940 (- 13 (* 2 3)) G__3942 (* 2 Math/PI)] | |
;; (clojure.core/fn [x y] (+ x G__3940 (/ y G__3942)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment