[ prog / sol / mona ]

prog


cddr

25 2024-08-21 13:20 *

>>24
that's interesting lore, i didn't know earlier lisps had that (useful) feature and will read more, this seems to restore defun destructuring:

(defmacro destructfun (name pattern &rest forms)
  (let ((list (gensym)))
    `(defun ,name (&rest ,list)
       (destructuring-bind ,pattern ,list
         ,@forms))))

(destructfun add (((a . b) (c . d) . rest))
  (declare (ignorable a c rest))
  (+ b d))

(add '((a . 1) (b . 2) (c . 3)))
29


VIP:

do not edit these