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

Bengt Kleberg bengt.kleberg@REDACTED
Thu Feb 3 11:04:35 CET 2011


Greetings,

Are you sure about this? I think that takewhile/2 returns a single list.

The function splitwith/2 returns a tuple.


ebngt

On Thu, 2011-02-03 at 10:56 +0100, maruthavanan s 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
>  		 	   		  



More information about the erlang-questions mailing list