Elixir (programming language): Difference between revisions

Content deleted Content added
Line 69:
%{"E" => 1, "i" => 2, "l" => 1, "r" => 1, "x" => 1}
 
iex> %{values: 1..5} |> Map.get(:values) |> Enum.map(& &1 * 2) |> Enum.sum()
[2, 4, 6, 8, 10]
 
iex> |> Enum.sum()
30
</syntaxhighlight>
Line 97 ⟶ 100:
</syntaxhighlight>
 
Multiple function bodies with [[Guard (computer science)#Mathematics|guards]]:
<syntaxhighlight lang="elixir">
def fib(n) when n in [0, 1], do: n
Line 103 ⟶ 106:
</syntaxhighlight>
 
Relational database accessdatabases with the Ecto library:
<syntaxhighlight lang="elixir">
schema "weather" do