# HG changeset patch # User Steve Losh # Date 1576108374 18000 # Node ID 164b3e41c13b649fd14c488cb637833ee59cddb3 # Parent f3327aa93670be7e50f2c7f1ccb0374de029b64d# Parent a996dd9ad3ebe7f944373696db137a9e9ea1e419 Merge. diff -r f3327aa93670 -r 164b3e41c13b package.lisp --- a/package.lisp Sun Dec 08 12:29:06 2019 -0500 +++ b/package.lisp Wed Dec 11 18:52:54 2019 -0500 @@ -177,6 +177,7 @@ (:export :-<> :<> + :_ :nest :recursively :recur diff -r f3327aa93670 -r 164b3e41c13b src/control-flow.lisp --- a/src/control-flow.lisp Sun Dec 08 12:29:06 2019 -0500 +++ b/src/control-flow.lisp Wed Dec 11 18:52:54 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.