[an error occurred while processing this directive]

cs150: Notes 18

Assignments Due


Assignment Expression: (set! Name Expression)

Evaluate Expression and replace the value associated with Name with the value of Expression.
Pair mutators: Why is mutation scary?

Why is mutation useful?

Why do our substitution evaluation rules fail when we allow mutation?

Would it be possible to create a circular list without using set-cdr!?

(define (map! f lst)
   (if (null? lst) (void)
           (set-car! lst (f (car lst)))
           (map! f (cdr lst)))))

cs1120: Computer Science
University of Virginia
Using these Materials