● 有点像面向对象的写法^-^
● 闭包?
(define counter (let ([next 0]) (lambda () (set! next (+ next 1)) next)))
(counter)
(counter)
(define make-counter (lambda () (let ([count 0]) (lambda () (set! count (+ count 1)) count))))
(define counter (make-counter))(counter)(counter)(counter)
转载于:https://www.cnblogs.com/volcanorao/p/11560209.html
相关资源:scheme简明教程