Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

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
# 122 Declare an enumeration Ø Ø @suits %{ "SPADES" => 1, "HEARTS" =>...
# 136 Remove all occurrences of a value ... Ø Enum.filter(items, fn v -> v != x end)
# 87 Stop program Ø System.halt()
# 91 Load JSON file into object Ø Ø defmodule JsonTest do def get_json(fil...
# 93 Pass a runnable procedure as parame... Ø Ø def control(f) do f() end
# 30 Parallelize execution of 1000 indep... Ø f = fn x -> x * :rand.uniform() end tas...
# 118 List to set Ø y = x |> Enum.uniq |> List.to_tuple
# 118 List to set Ø y = MapSet.new(x)
# 224 Add element to the beginning of the... Ø Ø items2 = [x | items]
# 133 Case-insensitive string contains Ø ok = s =~ ~r/#{word}/i
# 150 Remove trailing slash Ø Ø def main(string), do: String.replace_suf...
# 65 Format decimal number Ø s = "#{Float.round(x * 100, 1)}%"
# 81 Round floating point number to inte... Ø y = Kernel.round x
# 38 Extract a substring Ø t = String.slice(s, i..j-1)
# 12 Check if list contains a value Ø Enum.member?(list, x)
# 12 Check if list contains a value Ø Ø x in list
# 35 First-class function : compose Ø Ø def compose(f, g) do fn a -> g.(f....
# 94 Print the type of a variable Ø Ø [{_, type} | _] = IEx.Info.info(x) type
# 141 Iterate in sequence over two lists Ø Ø def main(items1, items2) do Enum.each(...
# 141 Iterate in sequence over two lists Ø Ø items1 ++ items2 |> Enum.each(&IO.puts/1...
# 55 Convert integer to string s = Integer.to_string(i)
# 55 Convert integer to string Ø s = to_string(i)
# 55 Convert integer to string Ø Ø s = "#{i}"
# 82 Count substring occurrences Ø s |> String.split(t) |> Enum.drop(1) |> ...
# 27 Create a 3-dimensional array Ø Ø def main(m, n, p) do if m == 0 or ...
# 10 Shuffle a list Ø y = Enum.shuffle x
# 14 Pick uniformly a random floating po... Ø a + :rand.uniform() * (b-a)
# 14 Pick uniformly a random floating po... Ø defmodule MyRandomPicker do def pick(a...
# 1 Print Hello World Ø IO.puts "Hello World"
# 1 Print Hello World Ø "Hello World" |> IO.puts
# 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: "...
# 37 Currying Ø Ø defmodule Curry do def curry(fun) do ...