[erlang-questions] List to proplist?
David Mercer
dmercer@REDACTED
Fri Nov 7 17:20:07 CET 2008
On Monday, October 20, 2008, Richard O'Keefe wrote
> 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.
Why is a cons cell, [Item|State1], preferred over a tuple, {Item, State1}?
Just wondering if there is a performance consideration or some other
consideration that I am missing. Please advise. Thank-you.
David Mercer
More information about the erlang-questions
mailing list