Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Enum Fuctions

livebook-sessions/enum_functions.livemd

Enum Fuctions

import IEx.Helpers
require Integer

Functions

h Enum
exports Enum
:functions
|> Enum.__info__()
|> Enum.map(fn {name, arity} -> 
  "#{name}/#{arity}" 
  end)
|> Enum.each(&IO.puts/1)
h Enum.any?
1..20 |> Enum.any?(&Integer.is_even/1) # true
1..20 |> Enum.all?(&Integer.is_even/1)
[] |> Enum.empty?() # true
%{one: 1, two: 2} |> Enum.empty?() # false
901..1000 |> Enum.filter(&(&1 > 990))
901..1000 |> Enum.find(&(&1 > 990))
1..1000 |> Enum.reject(&(&1 > 9))
[1, 1, 1, 1, 2, 2, 3, 1, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6] |> Enum.uniq()
1..1000 |> Enum.shuffle() |> Enum.drop_while(fn x -> x > 990 end)
Enum.zip(1..10, Enum.shuffle(21..30))
Enum.with_index(Enum.shuffle(21..30))
Enum.with_index(Enum.shuffle(21..30), 1)
Enum.with_index(Enum.shuffle(21..30), 1) |> Enum.at(0)
Enum.with_index(Enum.shuffle(21..30), 1) |> hd()
h Enum.flat_map()