[plt-scheme] Possible bug in for/fold
Hello,
If for/fold has no accumulators but it does have for-clauses that
iterate one or more times it gets upset:
-> (for/fold () ([i (in-range 4)]) (vector-set! (vector 0) 0 1))
context (lexical binding) expected 0 values, received 1 value: #<void>
This is because the body expression (in this case the vector-set!)
returns a value which for/fold is not expecting. This is kinda
contrived, but has arisen in the context of a macro I'm writing that
expands into for/fold (not for/fold/derived yet -- one step at a
time!)
It could well be argued this is not a bug, but I suggest one of two
improvements:
1. for/fold accepts the above case and returns vold
2. for/fold rejects this case and gives an error at macro expansion time
N.