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

maruthavanan s <>
Thu Feb 3 11:10:54 CET 2011


Sorry to all for the confusions.

> To: 
> From: 
> CC: 
> Date: Thu, 3 Feb 2011 11:04:35 +0100
> Subject: Re: [erlang-questions] lists:takewhile and lists:splitwith
> 
> 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
> >  		 	   		  
> 
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
> 
 		 	   		  


More information about the erlang-questions mailing list