Created
January 19, 2024 03:21
-
-
Save shayelkin/dd194d51f1b0d446be7bbdde3f164ed0 to your computer and use it in GitHub Desktop.
A lisp implementation of Clojure's threading macro
This file contains hidden or 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
(defmacro -> (form &rest forms) | |
(reduce | |
(lambda (acc next) | |
(if (listp next) | |
(list* (car next) acc (cdr next)) | |
(list next acc))) | |
forms | |
:initial-value form)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment