aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-02-15 15:04:00 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-02-15 15:04:00 +0000
commit395cd9357e2dbcf3bb0ffcaa45c79492ed4c3317 (patch)
treeda64b99369ea63d2d9c21758955aaf73ae837323 /lib
parentbe618327379eddb19a98edbcd3c37057f2fabeb9 (diff)
downloadcantedraw-395cd9357e2dbcf3bb0ffcaa45c79492ed4c3317.tar.gz
cantedraw-395cd9357e2dbcf3bb0ffcaa45c79492ed4c3317.tar.bz2
cantedraw-395cd9357e2dbcf3bb0ffcaa45c79492ed4c3317.zip
Rework `$` operator to take a capture variable
In case operators require use of a variable, we should let the caller provide the symbol so we don't fall into weird package issues.
Diffstat (limited to 'lib')
-rw-r--r--lib/macros.lisp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/macros.lisp b/lib/macros.lisp
index d182ce0..cb11901 100644
--- a/lib/macros.lisp
+++ b/lib/macros.lisp
@@ -80,11 +80,11 @@ arguments `LAMBDA-LIST' with body `BODY'."
(defun ,name ,lambda-list
,@body)))
-(defmacro $ (&rest forms)
+(defmacro $ (capture &rest forms)
"Given a sequence of FORMS, return a unary function which applies each form
sequentially"
- `(lambda (x)
- (->> x ,@forms)))
+ `(lambda (,capture)
+ (->> ,capture ,@forms)))
(defmacro alist-val (key alist)
"Helper macro for getting the value of KEY in ALIST."