[MLton] Monadic MLton.Vector.create with update

Daniel C. Wang danwang@CS.Princeton.EDU
Thu, 30 Mar 2006 09:56:46 -0800


Well, we have map,fold, and app when fold will do fine just by itself.
So the answer is to define unfold in the most general case and specialize.
I personally don't see the need for unfold to return the final state.

Henry Cejtin wrote:
> The whole question of wether unfoldi should return the final state, and of
> the state being carried is kind of a universal one.  Any time you are walking
> through a data structure (building or not), should you add a state arg,
> folded over the elements and returned at the end.  It is the same as the
> difference between app (or what MLton calls foreach) and fold.
>
> I don't have any good answer, but I know that when I want the extra state
> passed (and folded) along, it is a pain if it isn't, and when I don't want
> it, it is a pain to include the extra unit's.
>
> _______________________________________________
> MLton mailing list
> MLton@mlton.org
> http://mlton.org/mailman/listinfo/mlton
>