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 |
|||
|---|---|---|---|---|
| # 47 | Extract string suffix | ✓ | ✓ | t = String.slice(s, -5, 5) |
| # 47 | Extract string suffix | Ø | ✓ | <<_ :: binary-5>> <> t = s |
| # 59 | Write to standard error stream | Ø | ✓ | IO.puts :stderr, "#{x} is negative" |
| # 12 | Check if list contains a value | Ø | ✓ | Enum.member?(list, x) |
| # 12 | Check if list contains a value | Ø | Ø | x in list |
| # 48 | Multi-line string literal | Ø | Ø | s = "Spanning string works" |
| # 48 | Multi-line string literal | Ø | ✓ | s = """ multiline heredoc """ |
| # 48 | Multi-line string literal | Ø | ✓ | s = ~S""" This will print multiline and ... |
| # 302 | String interpolation | ✓ | Ø | s = "Our sun has #{x} planets" |
| # 96 | Check string prefix | Ø | ✓ | String.starts_with?(s,prefix) |
| # 140 | Delete map entry | Ø | ✓ | m = Map.delete(m, k) |
| # 4 | Create a function | Ø | Ø | @spec square(integer) :: integer def squ... |
| # 22 | Convert string to integer | Ø | ✓ | i = String.to_integer(s) |
| # 78 | "do while" loop | Ø | Ø | def main(condition) do case condition ... |
| # 250 | Pick a random value from a map | Ø | Ø | def main(m) do m |> Map.values() |... |
| # 146 | Convert string to floating point nu... | Ø | ✓ | f = String.to_float(s) |
| # 32 | Integer exponentiation by squaring | Ø | ✓ | :math.pow(x, n) |
| # 295 | String to Enum | Ø | Ø | def try_str_to_enum(t, string), do: t[st... |
| # 75 | Compute LCM | Ø | Ø | defmodule BasicMath do def gcd(a, 0), d... |
| # 116 | Remove occurrences of word from str... | Ø | ✓ | s2 = String.replace(s1, w, "") |
| # 39 | Check if string contains a word | Ø | ✓ | ok = String.contains?(s, word) |
| # 21 | Swap values | Ø | Ø | {a, b} = {b, a} |
| # 28 | Sort by a property | Ø | ✓ | Enum.sort_by(items, &(&1.p)) |
| # 8 | Create a map (associative array) | ✓ | Ø | x = %{"one" => 1, "two" => 2} |
| # 8 | Create a map (associative array) | Ø | Ø | x = %{one: 1, two: 2} |
| # 80 | Truncate floating point number to i... | Ø | ✓ | y = trunc(x) |
| # 56 | Launch 1000 parallel tasks and wait... | Ø | ✓ | # 1 f = &(IO.puts(&1)) # 2 printTimes ... |
| # 87 | Stop program | ✓ | Ø | System.halt() |
| # 69 | Seed random generator | Ø | Ø | :random.seed(s) |
| # 131 | Successive conditions | Ø | Ø | cond do c1 -> f1 c2 -> f2 c3 -> f3... |