Skip to content

Instantly share code, notes, and snippets.

Lyle Mantooth IslandUsurper

Block or report user

Report or block IslandUsurper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pmarreck
pmarreck / for_all_the_things.exs
Created Oct 9, 2017
Examples of various uses of the "for" syntax in Elixir
View for_all_the_things.exs
# A list generator:
iex> for n <- [1, 2, 3, 4], do: n * 2
[2, 4, 6, 8]
# A comprehension with two generators
iex> for x <- [1, 2], y <- [2, 3], do: x * y
[2, 3, 4, 6]
# A comprehension with a generator and a filter
iex> for n <- [1, 2, 3, 4, 5, 6], rem(n, 2) == 0, do: n
You can’t perform that action at this time.