[erlang-questions] Tried this... Thought it interesting... But it didn't work.

Sergej Jurečko sergej.jurecko@REDACTED
Tue Sep 1 17:33:40 CEST 2015


Both X and Y must be defined outside that list comprehension.


Sergej





On 01/09/15 17:30, "erlang-questions-bounces@REDACTED on behalf of lloyd@REDACTED" <erlang-questions-bounces@REDACTED on behalf of lloyd@REDACTED> wrote:

>So, I ran across this tidbit in the Erlang cybersphere:
>
>List Comprehension without generators
>
>http://blog.equanimity.nl/blog/2015/03/15/erlang-one-weird-trick-goodiebag/
>
>1> Y = 3.
>3
>2> Z = [X || Y > 2].
>* 1: variable 'X' is unbound
>
>OK.So I tried...
>
>-module(test).
>
>-compile(export_all).
>
>test(Y) ->
>  [ X || Y > 2].
>
>>3 test:test().
>Error: variable 'X' is unbound
>
>Waah...is someone pulling my leg?
>
>This worked...
>
>4> Z = [X || X <- [Y >2]].
>
>But it seems rather pointless.
>
>I didn't check to see if the original post was dated circa April 1.
>
>Best wishes,
>
>LRP
>
>
>
>_______________________________________________
>erlang-questions mailing list
>erlang-questions@REDACTED
>http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list