unfold

Henry Cejtin henry@sourcelight.com
Tue, 17 Jul 2001 19:48:54 -0500


Yes, although I would do 2 slight changes:
1. I would use `if i = n' as the termination condition.  It is the real
   termination condition, with >= just being used for the ease of optimization.
   (Not a strong objection by any means.)
2. I would call the results of the call to f (b, a') instead of (b, a).

I'm assuming that then List.tabulate will be written as an application of
unfold.

Ah yes, these are much better functions for generating things.  Did you see
any uses in the compiler?

Currently, does Vector.tabulate cheat and cast the result into a Vector from
an array?  I guess it must.