Paste number 22074: splice, use what instead ?

Paste number 22074: splice, use what instead ?
Pasted by: lhz
2 years, 6 months ago
#lisp
Paste contents:
Raw Source | XML | Display As

(defmacro splice (args fun)
  (let ((res (gensym)) (n 0))
  `(let (,res)
   (setf ,res ,fun)
   ,(append (list 'progn)
     (mapcar (lambda (arg)
       `(setf ,arg (elt ,res ,(1- (incf n))))
)

       args
)
)

  
)
)
)


(let (a b c)
(splice (a b c) (list 1 2 3 4))
)

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.