I have MZScheme. I execute:
- (insertR 3 2 '(1 2))
I get
- (1 2 3)
That floats my boat. Now I fire up SISC 1.8.8. Again, I execute:
- (insertR 3 2 '(1 2))
This time I get:
- (1 2)
What gives?
(define insertR
(lambda (new old lat)
(cond
((null? lat) '())
(else
(cond
((eq? (car lat) old) (cons old (cons new (cdr lat))))
(else
(cons (car lat) (insertR new old (cdr lat)))))))))
No comments:
Post a Comment