I learn Erlang and list comprehensions now and have discovered a weird (as for me) issue. So I have a simple list comprehension with a simple formula and without filter:
gen_list(List)->
[N*N || N <- List].
The output is correct as I expected: gen_list([2,3,4]). [4,9,16]
Then I do this:
gen_list(List)->
[N*N*N*N || N <- List].
And the output is correct again: gen_list([2,3,4]). [16,81,256]
.
But when I define formula as:gen_list(List)->
[N*N*N || N <- List].
I got next output:gen_list([2,3,4]). "\b\e@"
.
What is this:"\b\e@"
?? Why I got it only when I have three N? I can even write the formula like this:N*N*N*N*N*N*N*N
, and the output again will be as I expected. But with three N I always got such a weird result. Can someone explain this for me?
I use ArchLinux and GNU Emacs.