Skip to content

Instantly share code, notes, and snippets.

@shayelkin
Created January 19, 2024 03:21
Show Gist options
  • Save shayelkin/dd194d51f1b0d446be7bbdde3f164ed0 to your computer and use it in GitHub Desktop.
Save shayelkin/dd194d51f1b0d446be7bbdde3f164ed0 to your computer and use it in GitHub Desktop.
A lisp implementation of Clojure's threading macro
(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