This list shows some idioms having at least : 1 Elixir implementation with some empty fields.
You may click on a missing field and fill the gap.
| Demo URL |
Doc URL |
|||
|---|---|---|---|---|
| # 250 | Pick a random value from a map | Ø | Ø | def main(m) do m |> Map.values() |... |
| # 28 | Sort by a property | Ø | ✓ | Enum.sort_by(items, &(&1.p)) |
| # 147 | Remove all non-ASCII characters | Ø | ✓ | t = s |> String.to_charlist() |>... |
| # 147 | Remove all non-ASCII characters | Ø | Ø | t = for <<c <- s>>, c in 0..127, into: "... |
| # 71 | Echo program implementation | Ø | ✓ | Enum.join(args, " ") |
| # 23 | Convert real number to string with ... | Ø | ✓ | s = Float.to_string(x, decimals: 2) |
| # 47 | Extract string suffix | ✓ | ✓ | t = String.slice(s, -5, 5) |
| # 47 | Extract string suffix | Ø | ✓ | <<_ :: binary-5>> <> t = s |
| # 99 | Format date YYYY-MM-DD | Ø | ✓ | x = Date.to_iso8601(d) |
| # 5 | Create a 2D Point data structure | Ø | ✓ | p = [ x: 1.122, y: 7.45 ] |
| # 5 | Create a 2D Point data structure | Ø | Ø | {x, y} defmodule Point do defstruct x:... |
| # 63 | Replace fragment of a string | Ø | ✓ | x2 = String.replace(x, y, z) |
| # 41 | Reverse a string | Ø | ✓ | t = String.reverse(s) |
| # 83 | Regex with character repetition | Ø | ✓ | r = Regex.compile!("htt+p") |
| # 205 | Get an environment variable | Ø | ✓ | foo = System.get_env("FOO", "none") |
| # 54 | Compute sum of integers | Ø | ✓ | s = Enum.sum(x) |
| # 13 | Iterate over map keys and values | Ø | ✓ | Enum.each(mymap, fn({k, x}) -> IO.puts... |
| # 13 | Iterate over map keys and values | Ø | Ø | for {k, x} <- mymap do IO.puts("#{k} =... |
| # 153 | Concatenate string with integer | Ø | ✓ | t = s <> to_string(i) |
| # 244 | Print a map | ✓ | Ø | IO.inspect m |
| # 137 | Check if string contains only digit... | Ø | Ø | b = Regex.match?(~r{\A\d*\z}, s) |
| # 152 | Turn a character into a string | Ø | Ø | to_string(char) |
| # 30 | Parallelize execution of 1000 indep... | Ø | ✓ | f = fn x -> x * :rand.uniform() end tas... |
| # 266 | Repeated string | Ø | ✓ | s = String.duplicate(v, n) |
| # 9 | Create a Binary Tree data structure | Ø | Ø | defmodule BinaryTree do defstruct data:... |
| # 1 | Print Hello World | Ø | ✓ | IO.puts "Hello World" |
| # 1 | Print Hello World | Ø | ✓ | "Hello World" |> IO.puts |
| # 93 | Pass a runnable procedure as parame... | Ø | Ø | def control(f) do f() end |
| # 302 | String interpolation | ✓ | Ø | s = "Our sun has #{x} planets" |
| # 126 | Multiple return values | Ø | Ø | def foo, do: {"bar", true} |