lists:takewhile and lists:splitwith

maruthavanan s maruthavanan_s@REDACTED
Thu Feb 3 10:56:14 CET 2011


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