list comprehension compilation

Thomas Raes <>
Sun Jul 30 23:45:58 CEST 2006


Hello,

I'm new to Erlang and I've got a question about list comprehensions:

Compiling code that contains list comprehensions with lots of variables
seems to take a long time on my system.
For example, compiling the following code takes more than 4 minutes:

test() ->
  
[[X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18,X19,X20] ||
        X1 <- [0],X2 <- [0],X3 <- [0],X4 <- [0],X5 <- [0],X6 <- [0],X7
<- [0],X8 <- [0],X9 <- [0],X10 <- [0],
        X11 <- [0],X12 <- [0],X13 <- [0],X14 <- [0],X15 <- [0],X16 <-
[0],X17 <- [0],X18 <- [0],X19 <- [0],X20 <- [0]].

However, when I enter this code at the erl-prompt, it evaluates immediately.
The more variables there are, the longer the compilation takes.
Is this normal or am I doing something wrong? (I've compiled the code
with "c(filename)." in the erl prompt.).

Best regards,

Thomas

PS: I've used: Erlang (BEAM) emulator version 5.5 [source]
[async-threads:0] [hipe]




More information about the erlang-questions mailing list