Hi, I am trying to wrap my head around following, from SICP<http://mitpress.mit.edu/sicp/full-text/book/book.html>book:
#;1> (define a (cons 1 2)) #;2> (define b (cons a a)) #;3> a (1 . 2) #;4> b ((1 . 2) 1 . 2) #;5> (set-car! (car b) 3) #;6> a (3 . 2) ... changing underlying value affects everything. However in seemingly similar exercise: #;1> (define x 1) #;2> (define a (cons x x)) #;3> (define b (cons a a)) #;4> a (1 . 1) #;5> b ((1 . 1) 1 . 1) #;6> (set! x 3) #;7> a (1 . 1) #;8> b ((1 . 1) 1 . 1) nothing really happens. It poses the question, at what point Scheme uses references instead of evaluating the result. Any ideas? Thx, Andy
_______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
