Return to Snippet

Revision: 23323
at February 4, 2010 06:27 by magicrebirth


Initial Code
(define-macro (change-list lst)
  `(set! ,lst (map (lambda (i) (+ i 1)) ,lst)))


(define mylist '(1 2 3 4 5))


(change-list mylist)

Initial URL


Initial Description
set-car! and set-cdr! change a list 'in-place'.

But, if you like the pointer metaphore... you could use macro's
instead of procedures...

stupidly simple example...

Initial Title
Change list in place : scheme/impromtu

Initial Tags


Initial Language
Scheme