标签:counter set scheme make 闭包 nbsp lam next def
(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)
标签:counter set scheme make 闭包 nbsp lam next def
原文地址:https://www.cnblogs.com/volcanorao/p/11560209.html