gaucheノート  list-ec

$ gosh
gosh> (use srfi-42)
#<undef>
gosh> (list-ec (: i 5) i)
(0 1 2 3 4)
gosh> (list-ec (: i 1 5) i)
(1 2 3 4)
gosh> (list-ec (: i 1 6) i)
(1 2 3 4 5)
gosh> (define (square n) (* n n))
square
gosh> (map square (list-ec (: i 10) (+ i 1))
)
(1 4 9 16 25 36 49 64 81 100)
gosh> (define (ntom n m) (list-ec (: i n m) i))
ntom
gosh> (ntom 2 3)
(2)
gosh> (define (ntom n m) (list-ec (: i n (+ m 1)) i))
ntom
gosh> (ntom 2 3)
(2 3)
gosh> (ntom 3 5)
(3 4 5)
gosh> (map square (ntom 3 12))
(9 16 25 36 49 64 81 100 121 144)

参照したURL: http://www.lulu.com/items/volume_63/3470000/3470500/1/print/gauche-refj-0.8.13-unofficial.pdf