Fri Jun 13 16:28:04 CEST 2008
It is *supposed* to drop the elements of a list as long as they evaluate the
predicate to 'true'. As soon as the predicate evaluates to false then that
element and the rest of the list are returned. It is *not* the equivalent of
filter/2 with the inverse test.
2008/6/13 Matt Handler <>:
> dropwhile does not work properly as defined in R12B-2:
> 01 dropwhile(Pred, [Hd|Tail]=Rest) ->
> 02 case Pred(Hd) of
> 03 true -> dropwhile(Pred, Tail);
> 04 false -> Rest
> 05 end;
> 06 dropwhile(Pred, ) when is_function(Pred, 1) -> .
> it returns the entire list once it finds an element that doesn't match
> here's what i did instead:
> dropwhile(Fun, List) ->
> [Element ||
> Element <- List,
> Fun(Element) =/= true].
> erlang-bugs mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-bugs