[plt-scheme] Possible bug in for/fold
On Fri, Jun 27, 2008 at 1:10 PM, Noel Welsh <noelwelsh at gmail.com> wrote:
> On Fri, Jun 27, 2008 at 5:12 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> That seems like the right thing to me. Is there some reason that your
>> macro can't/shouldn't match the zero accumulators with zero results?
>
> My macro can and does work around this. It just struck me that this
> seemed like an asymmetric case that could be made more symmetric (I
> think (values) the only way to generate zero results) or a programmer
> error that could be statically detected and better reported. It took
> me some time to debug.
The behavior of for/fold seems perfectly symmetric to me (for/fold
expects exactly as many values as it has accumulators in all cases).
Your suggestions - rejecting zero-accumulator for/fold, or allowing
single-void-valued returns in a zero-valued for/fold - seem asymmetric
to me (for/fold treats the 0 case specially). Which is not to say
they're bad, they're very pragmatic suggestions, but I don't
understand why you call for/fold "asymmetric". Could you elaborate?
--
Carl Eastlund