164b3e41c13b

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 11 Dec 2019 18:52:54 -0500
parents f3327aa93670 (current diff) a996dd9ad3eb (diff)
children 765870ef20f7
branches/tags (none)
files

Changes

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