mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
can disable with USE_BIGNUMS=0 - the interactions between this and USE_FLONUMS are messy, so they will likely be merged into a single option in the near future (i.e. you either have only fixnums, or a full range of numeric types). adding rationals based on this would be easy and is a likely future feature. adding native support for complex numbers is unlikely.
16 lines
261 B
Scheme
16 lines
261 B
Scheme
|
|
(define (make-counter n)
|
|
(lambda ()
|
|
(set! n (+ n 1))
|
|
n))
|
|
|
|
(define f (make-counter 0))
|
|
(define g (make-counter 100))
|
|
|
|
(write (f)) (newline)
|
|
(write (f)) (newline)
|
|
(write (g)) (newline)
|
|
(write (g)) (newline)
|
|
(write (f)) (newline)
|
|
(write (g)) (newline)
|
|
|