[erlang-questions] lists:takewhile and lists:splitwith

Torben Hoffmann torben.lehoff@REDACTED
Thu Feb 3 11:01:14 CET 2011


use
fun(A) -> A <3 end
instead.

On Thu, Feb 3, 2011 at 10:56, maruthavanan s <maruthavanan_s@REDACTED>wrote:

>
> Hi,
>
> The document says lists:takewhile(Pred,List) would return tuple of lists
> which would split the List when Pred returns true.
>
> I tried the below.
>
>  lists:takewhile(fun(A)-> A==3 end,[1,2,3,4,5]).
>
> it gives me an empty result.. What should I do to  get {[1,2],[3,4,5]}
>
> Regards,
> Marutha
>




-- 
http://www.linkedin.com/in/torbenhoffmann


More information about the erlang-questions mailing list