[erlang-questions] List to proplist?

Dave Smith dave.smith.to@REDACTED
Tue Oct 21 16:41:06 CEST 2008


Nice! Your second version is much better.  It's also clearer than Richards
foldr version.

This also my first introduction to unfold. I will definitely be looking for
application of this pattern in the future.


2008/10/20 Richard O'Keefe <ok@REDACTED>

> A version of unfold that I prefer is
>
> unfold(State, Splitter) ->
>     unfold(State, Splitter, []).
>
> ...
> to_proplist(Even_List) ->
>     unfold(Even_List, fun ([Key,Val|Rest]) -> [{Key,Val}|Rest]
>                         ; ([])             -> []
>                       end).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081021/0685f6cb/attachment.htm>


More information about the erlang-questions mailing list