Example: ENQUEUE
Like PUSH, but puts the new element at the end of the list.
(defmacro enqueue (item lst)
‘(if (null ,lst) (setq ',lst '(,item))
(nconc ,lst (list ,item)) ) )
> (setq q '(a b c))
(A B C)
> (enqueue 'd q)
(A B C D)
Previous slide
Next slide
Back to first slide
View graphic version