[erlang-questions] Why lists:dropwhile() didn't return the expected result?[Understood]

Per Hedeland per@REDACTED
Thu May 1 20:30:44 CEST 2008


catsunny <catsunny@REDACTED> wrote:
>At the time when I read the library refence, I misunderstood the  
>description, it says:
>
>    Drops elements Elem from List1 while Pred(Elem) returns true and  
>returns the remaining list.
>
>But I took while for when, so in my mind it becomes:
>    Drops elements Elem from List1 when Pred(Elem) returns true and returns  
>the remaining list.

And if your really want "when", the function to use is lists:filter/2 -
a.k.a "takewhen".:-)

--Per



More information about the erlang-questions mailing list