Created
July 23, 2015 12:10
-
-
Save lispm/5604501cdaa52456ee58 to your computer and use it in GitHub Desktop.
Pipe, threading, sequencing expressions in Common Lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro pipe (expression &rest expressions) | |
(if (null expressions) | |
expression | |
(destructuring-bind ((fn arg &rest args) &rest more-expressions) | |
expressions | |
`(pipe | |
(let ((,arg ,expression)) | |
(,fn ,arg ,@args)) | |
,@more-expressions)))) | |
(defmacro pipe (expression &rest expressions) | |
(if (null expressions) | |
expression | |
(destructuring-bind ((fn arg &rest args) &rest more-expressions) | |
expressions | |
(declare (ignorable arg)) | |
`(pipe | |
(,fn ,expression ,@args) | |
,@more-expressions)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment