--- 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
--- 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.