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...
- (define-macro (change-list lst)
- `(set! ,lst (map (lambda (i) (+ i 1)) ,lst)))
- (define mylist '(1 2 3 4 5))
- (change-list mylist)
You need to login to post a comment.