Last active
December 21, 2015 06:18
-
-
Save ifesdjeen/6262725 to your computer and use it in GitHub Desktop.
In Control Structures of Let-over-lambda, they describe an idea of taking bindings and writing a macro that substitutes symbols for values. That's pretty much same thing. quote from the book itself:
The expansion uses Labels special form to bind a function around the provided body. The function is named according to the symbol used in the named …
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
;; Writing something remotely reminding nlet | |
(defmacro body-and-bindings | |
[bindings & body] | |
`(let [~(first bindings) 1 | |
~(second bindings) 2] | |
~@body)) | |
;; Expands to: | |
(let* [a 1 b 2] (+ a b)) | |
(body-and-bindings [a b] (+ a b)) | |
;; => 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment