I know it is possible, but I'm not sure aboout how to write the following with a functional approach:
(loop for i from 1 to 10 collect (loop for j from 1 to i collect j))
((1) (1 2) (1 2 3) (1 2 3 4) (1 2 3 4 5) (1 2 3 4 5 6) (1 2 3 4 5 6 7) (1 2
3 4 5 6 7 8) (1 2 3 4 5 6 7 8 9) (1 2 3 4 5 6 7 8 9 10))
Gauche Scheme:
(define (rng low high func)
(if (> low high)
'()
(cons (func low) (rng (+ 1 low) high func))))
(rng 1 10 (cut rng 1 <> values))
===>
((1) (1 2) (1 2 3) (1 2 3 4) (1 2 3 4 5) (1 2 3 4 5 6) (1 2 3 4 5 6 7)
(1 2 3 4 5 6 7 8) (1 2 3 4 5 6 7 8 9) (1 2 3 4 5 6 7 8 9 10))
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)