[erlang-questions] List to proplist?

Hans Bolinder hans.bolinder@REDACTED
Mon Nov 3 12:18:49 CET 2008


[Richard Carlsson:]
> 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.
> 
> I was going to comment on this before, but didn't get around to it.
> Please don't use the return convention above; it is not normal
> Erlang programming style, and introduces an improper list for no
> really good reason. A more traditional return convention would
> use e.g., {Item,State1} | 'none'.

Thank you for your comments. We have, however, decided not to modify
the code provided by Richard O'Keefe.

Best regards,

Hans Bolinder, Erlang/OTP team, Ericsson



More information about the erlang-questions mailing list