[erlang-questions] Lists Comprehension issue?
Carlos Suarez Fontalvo
Wed Jan 14 13:50:25 CET 2015
On Wednesday, January 14, 2015, Bob Ippolito <bob@REDACTED> wrote:
> 20 is not a list of lists.
> On Wednesday, January 14, 2015, Carlos Suarez Fontalvo <
>> Hi. I've reading this documentation:
>> And it says that
>> 3.5 Simplifications with List Comprehensions
>> As an example, list comprehensions can be used to simplify some of the
>> functions in lists.erl:
>> append(L) -> [X || L1 <- L, X <- L1].
>> map(Fun, L) -> [Fun(X) || X <- L].
>> filter(Pred, L) -> [X || X <- L, Pred(X)].
>> However when I tried to test this first example "append" doing something simple like this:
>> 73> [X || L1 <- 20, X <- L1].
>> ** exception error: bad generator 20
>> I got a "exception error" message. Any idea why?. Am I not considering something?
>> Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions