[erlang-questions] List to proplist?

Robert Virding <>
Tue Oct 21 17:19:46 CEST 2008


Same Richard!

2008/10/21 Dave Smith <>

> 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 <>
>
>> 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/b15b1987/attachment.html>


More information about the erlang-questions mailing list