Chibi-scheme Error with Iterator

154 views Asked by At

Anyone got any idea why chibi-scheme throws the error below while attempting to use the chibi-loop up-from function:

ERROR: car: not a pair: #<opcode cons>
ERROR in set-dk! on line 590 of file /usr/local/share/chibi/init-7.scm: cdr: not a pair: ()

I am using the syntax in the following way:

(import (chibi loop))

>(up-from 0 (to 20) (by 2))
1

There are 1 answers

1
C. K. Young On BEST ANSWER

You can't use up-from standalone like that. It only works inside of a loop form:

> (loop ((for x (up-from 0 (to 20) (by 2))))
    (display x)
    (newline))
0
2
4
6
8
10
12
14
16
18