[Haskell-beginners] boomBangs xs = [ if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x]

anthony niro proant88 at hotmail.com
Tue Jun 21 21:58:05 CEST 2011


Hello,

My name is Anthony i have few question about Haskell.

I was reading a tutorial everything goes well. but now i have few things that i dont understang.

HERE:

boomBangs xs = [ if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x]



I dont understand this line except the "if" "then" "else".  
What is xs? 
what is the |  ? 
 and why doing this  "  | x <- xs, odd x]"

why x <- xs????? what is that 

and what is odd x? 

thx everyone for answer me. 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110621/a24fac3f/attachment.htm>


More information about the Beginners mailing list