Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (12 sloc) 578 Bytes
# A list comprehension is a syntactic construct available in some programming
# languages for creating a list based on existing lists.
# http://en.wikipedia.org/wiki/List_comprehension
# http://www.erlang.org/doc/programming_examples/list_comprehensions.html
@public
run = fn () {
A = [X for X in lists.seq(1, 10)]
B = [X for X in lists.seq(1, 10) if X % 2 == 0]
C = [X for X in lists.seq(1, 10) if X % 2 == 0 and X != 4]
D = [(X, Y) for X in lists.seq(1, 3) if X != 1 for Y in lists.seq(11, 13) if Y != 11]
io.format("~p~n~p~n~p~n~p~n", [A, B, C, D])
}
Something went wrong with that request. Please try again.