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