Skip to content

Instantly share code, notes, and snippets.

@kachayev
Created September 14, 2013 10:07
Show Gist options
  • Select an option

  • Save kachayev/6560729 to your computer and use it in GitHub Desktop.

Select an option

Save kachayev/6560729 to your computer and use it in GitHub Desktop.
iex(1)> import Scala
nil
iex(2)> s = for do
...(2)> f <- [1,2,3]
...(2)> g <- [1,2,3]
...(2)> if (rem f+g, 2) == 0
...(2)> yield {f, g*2}
...(2)> end
iex(3)> Enum.to_list s
[{1, 2}, {1, 6}, {2, 4}, {3, 2}, {3, 6}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment