[erlang-questions] list comprehensions with predefined functions?

Circular Function circularfunc@REDACTED
Wed Jun 18 14:08:52 CEST 2008


how do i use a predefined function in a listcomprehension?

and if i have 2 variables how do I write then?


42> c(mymath).            
{ok,mymath}
43> [mymath:power || X <- [1,2,3] Y <- 3].
* 1: syntax error before: Y
43> [mymath:power || X <- [1,2,3], Y <- 3].
* 1: illegal expression
44> [mymath:cube || X <- [1,2,3]].         
* 1: illegal expression
45> [X*2 || X <- [1,2,3]].                 
[2,4,6]
46> [X*X || X <- [1,2,3]].
[1,4,9]
47> [X*2 || X <- [1,2,3]].        
[2,4,6]
48> [mymath:sq || X <- [1,2,3]].
* 1: illegal expression
49> 



      __________________________________________________________
Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. 
Sök och jämför hos Yahoo! Shopping.
http://shopping.yahoo.se/c-100015813-bredband.html?partnerId=96914325
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080618/2b1da26a/attachment.htm>


More information about the erlang-questions mailing list