# HG changeset patch # User Steve Losh # Date 1576108309 18000 # Node ID a996dd9ad3ebe7f944373696db137a9e9ea1e419 # Parent b839a83bbf2e3bf2abef6f53ab47b29783945475 Add `_` diff -r b839a83bbf2e -r a996dd9ad3eb package.lisp --- a/package.lisp Fri Dec 06 21:00:13 2019 -0500 +++ b/package.lisp Wed Dec 11 18:51:49 2019 -0500 @@ -177,6 +177,7 @@ (:export :-<> :<> + :_ :nest :recursively :recur diff -r b839a83bbf2e -r a996dd9ad3eb src/control-flow.lisp --- a/src/control-flow.lisp Fri Dec 06 21:00:13 2019 -0500 +++ b/src/control-flow.lisp Wed Dec 11 18:51:49 2019 -0500 @@ -13,6 +13,19 @@ forms)) <>)) +(defmacro _ (expr &rest forms) + "Thread the given forms, with `_` as a placeholder." + ;; I am going to lose my fucking mind if I have to program lisp without + ;; a threading macro, but I don't want to add another dep to this library, so + ;; here we are. + `(let* ((_ ,expr) + ,@(mapcar (lambda (form) + (if (symbolp form) + `(_ (,form _)) + `(_ ,form))) + forms)) + _)) + (defmacro nest (&rest forms) "Thread the given forms, putting each as the body of the previous.