# HG changeset patch # User Steve Losh # Date 1485001653 0 # Node ID df57ee0487619fce7a00fe3b62a4bef1510c2233 # Parent 8b5c27a2d2de1476a6738f88f3cc0c58905ae8aa Unfuck `-<>` diff -r 8b5c27a2d2de -r df57ee048761 losh.lisp --- a/losh.lisp Sat Jan 21 11:29:14 2017 +0000 +++ b/losh.lisp Sat Jan 21 12:27:33 2017 +0000 @@ -1,18 +1,18 @@ (in-package :losh) ;;;; Sanity ------------------------------------------------------------------- -(defmacro -<> (&rest 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. - (if (null forms) - '<> - (destructuring-bind (form . remaining) forms - `(let ((<> ,(if (symbolp form) - `(,form <>) - form))) - (-<> ,@remaining))))) + `(let* ((<> ,expr) + ,@(mapcar (lambda (form) + (if (symbolp form) + `(<> (,form <>)) + `(<> ,form))) + forms)) + <>)) ;;;; Types --------------------------------------------------------------------