iex(2)> import Enum Enum iex(3)> deck = for rank <- '23456789TJQKA', suit <- 'CDHS', do: [suit,rank] ['C2', 'D2', 'H2', 'S2', 'C3', 'D3', 'H3', 'S3', 'C4', 'D4', 'H4', 'S4', 'C5', 'D5', 'H5', 'S5', 'C6', 'D6', 'H6', 'S6', 'C7', 'D7', 'H7', 'S7', 'C8', 'D8', 'H8', 'S8', 'C9', 'D9', 'H9', 'S9', 'CT', 'DT', 'HT', 'ST', 'CJ', 'DJ', 'HJ', 'SJ', 'CQ', 'DQ', 'HQ', 'SQ', 'CK', 'DK', 'HK', 'SK', 'CA', 'DA', ...] iex(4)> [1,2,3] [1, 2, 3] iex(5)> [101,102,103] 'efg' iex(6)> deck = for rank <- '23456789TJQKA', suit <- 'CDHS', do: {suit,rank} [{67, 50}, {68, 50}, {72, 50}, {83, 50}, {67, 51}, {68, 51}, {72, 51}, {83, 51}, {67, 52}, {68, 52}, {72, 52}, {83, 52}, {67, 53}, {68, 53}, {72, 53}, {83, 53}, {67, 54}, {68, 54}, {72, 54}, {83, 54}, {67, 55}, {68, 55}, {72, 55}, {83, 55}, {67, 56}, {68, 56}, {72, 56}, {83, 56}, {67, 57}, {68, 57}, {72, 57}, {83, 57}, {67, 84}, {68, 84}, {72, 84}, {83, 84}, {67, 74}, {68, 74}, {72, 74}, {83, 74}, {67, 81}, {68, 81}, {72, 81}, {83, 81}, {67, 75}, {68, 75}, {72, 75}, {83, 75}, {67, ...}, {...}, ...] iex(7)> deck = for rank <- '23456789TJQKA', suit <- 'CDHS', do: [suit,rank] ['C2', 'D2', 'H2', 'S2', 'C3', 'D3', 'H3', 'S3', 'C4', 'D4', 'H4', 'S4', 'C5', 'D5', 'H5', 'S5', 'C6', 'D6', 'H6', 'S6', 'C7', 'D7', 'H7', 'S7', 'C8', 'D8', 'H8', 'S8', 'C9', 'D9', 'H9', 'S9', 'CT', 'DT', 'HT', 'ST', 'CJ', 'DJ', 'HJ', 'SJ', 'CQ', 'DQ', 'HQ', 'SQ', 'CK', 'DK', 'HK', 'SK', 'CA', 'DA', ...] iex(8)> [101,102,103,7500] [101, 102, 103, 7500] iex(9)> deck |> shuffle |> take(13) ['D3', 'H8', 'CA', 'DT', 'S4', 'HQ', 'C8', 'SA', 'S3', 'D2', 'D4', 'DJ', 'SQ'] iex(10)> c "loop.ex" [Loop] iex(11)> Loop.doit([1,2,3]) [2, 3, 4] iex(12)> c "loop.ex" = Compilation error on file loop.ex == ** (TokenMissingError) loop.ex:11: missing terminator: end (for "do" starting at line 1) (elixir) lib/kernel/parallel_compiler.ex:117: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1 ** (exit) shutdown: 1 (elixir) lib/kernel/parallel_compiler.ex:291: Kernel.ParallelCompiler.handle_failure/3 (elixir) lib/kernel/parallel_compiler.ex:247: Kernel.ParallelCompiler.wait_for_messages/1 (elixir) lib/kernel/parallel_compiler.ex:62: Kernel.ParallelCompiler.spawn_compilers/3 (iex) lib/iex/helpers.ex:170: IEx.Helpers.c/2 iex(12)> c "loop.ex" warning: redefining module Loop (current version defined in memory) loop.ex:1 [Loop] iex(13)> Loop.doit2([1,2,3]) [2, 3, 4] iex(14)> Loop.doit2([1,2,3]) [2, 3, 4] iex(15)> c "loop.ex" warning: redefining module Loop (current version defined in memory) loop.ex:1 [Loop] iex(16)> Loop.doit3([1,2,3]) [2, 3, 4] iex(17)> ^C BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a