Mon, 30 Jul 2001 21:12:29 -0700
There are 8 possibilites for unfold
size specified or not
integer passed or not
left-to-right or right-to-left.
The compromise is that we don't have all 8, we just have 4, where the integer is
passed only for the ones where the size is specified. Thus we have the
val unfold: 'b * ('b -> ('a * 'b) option) -> 'a t
val unfoldi: int * 'b * (int * 'b -> ('a * 'b)) -> 'a t
val unfoldr: 'b * ('b -> ('a * 'b) option) -> 'a t
val unfoldri: int * 'b * (int * 'b -> ('a * 'b)) -> 'a t
I think it does make sense to pass the integer in the "i" versions, since (1) it
is already being computed, (2) it is more likely necessary than not, and (3)
it is syntactally easier to ignore than add to the state.