Implement specific function generation functions for each threading macro
This commit is contained in:
@@ -101,11 +101,25 @@ arguments `LAMBDA-LIST' with body `BODY'."
|
|||||||
(defun ,name ,lambda-list
|
(defun ,name ,lambda-list
|
||||||
,@body)))
|
,@body)))
|
||||||
|
|
||||||
(defmacro $ (capture &rest forms)
|
(defmacro $-> (capture &rest forms)
|
||||||
"Given a sequence of FORMS, return a unary function which applies each form
|
"Given a sequence of FORMS, return a unary function which applies each form
|
||||||
sequentially"
|
sequentially via -->"
|
||||||
`(lambda (,capture)
|
`(lambda (,capture)
|
||||||
(->> ,capture ,@forms)))
|
(--> ,capture ,capture ,@forms)))
|
||||||
|
|
||||||
|
(defmacro $<> (&rest forms)
|
||||||
|
"Given a sequence of FORMS, return a unary function which applies each form
|
||||||
|
sequentially via -<>"
|
||||||
|
(let ((capture (gensym)))
|
||||||
|
`(lambda (,capture)
|
||||||
|
(-<> ,capture ,@forms))))
|
||||||
|
|
||||||
|
(defmacro $>> (&rest forms)
|
||||||
|
"Given a sequence of FORMS, return a unary function which applies each form
|
||||||
|
sequentially via ->>"
|
||||||
|
(let ((capture (gensym)))
|
||||||
|
`(lambda (,capture)
|
||||||
|
(->> ,capture ,@forms))))
|
||||||
|
|
||||||
(defmacro alist-val (key alist)
|
(defmacro alist-val (key alist)
|
||||||
"Helper macro for getting the value of KEY in ALIST."
|
"Helper macro for getting the value of KEY in ALIST."
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
:--> :->> :-<>
|
:--> :->> :-<>
|
||||||
:-> :fn
|
:-> :fn
|
||||||
:while :alist-val
|
:while :alist-val
|
||||||
:$))
|
:$-> :$>> :$<>))
|
||||||
|
|
||||||
(defpackage cantedraw.lib.functions
|
(defpackage cantedraw.lib.functions
|
||||||
(:nicknames :5d-lib.functions)
|
(:nicknames :5d-lib.functions)
|
||||||
|
|||||||
Reference in New Issue
Block a user