I'm looking at some old Scheme code and find that the code still works under (#lang racket) but trace is unhappy with the use of set! in the traced function.
set!: cannot modify a constant: next-leaf-generator I also tried (#lang r5rs) but it's unhappy with my require. (require racket/trace) => expand: unbound identifier in module in: require What #lang/require must I use to work around this? Michael ========== #lang racket (require racket/trace) (define next-leaf-generator (λ (obj eot) (letrec ((return #f) (cont (λ (x) (recur obj) (set! cont (λ (x) (return eot))) (cont #f))) (recur (λ (obj) (if (pair? obj) (for-each recur obj) (call/cc (λ (c) (set! cont c) (return obj))))))) (λ () (call/cc (λ (ret) (set! return ret) (cont #f))))))) (define leaf-eq? (λ (x y) (let* ((eot (list 'eot)) (xf (next-leaf-generator x eot)) (yf (next-leaf-generator y eot))) (letrec ((loop (λ (x y) (cond ((not (eq? x y)) #f) ((eq? eot x) #t) (else (loop (xf) (yf))))))) (loop (xf) (yf)))))) ;> (leaf-eq? '(a (b (c))) '((a) b c)) ;#t ;> (leaf-eq? '(a (b (c))) '((a) b c d)) ;#f ;>
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users