[erlang-questions] List to proplist?
Wed Oct 29 13:41:46 CET 2008
The unfold/2 below seems to take a fun. Many functions in the lists
module take their fun as the first argument. For consistency it would
perhaps be a good idea to let unfold/2 also takes the fun as its first
This is all provided that Splitter is a fun, of course.
On Wed, 2008-10-29 at 13:15 +0100, Hans Bolinder wrote:
> [Richard O'Keefe:]
> > A version of unfold that I prefer is
> > unfold(State, Splitter) ->
> > unfold(State, Splitter, ).
> > unfold(State, Splitter, Acc) ->
> > case Splitter(State)
> > of  -> lists:reverse(Acc)
> > ; [Item|State1] -> unfold(State1, Splitter, [Item|Acc])
> > end.
> lists:unfold/2 has been added to the upcoming R12B-5 release.
> Best regards,
> Hans Bolinder, Erlang/OTP team, Ericsson
> erlang-questions mailing list
More information about the erlang-questions