Elixirの対話モードでEnumの動作を確認してみた

# 概要
Elixirの対話モードでEnumの動作を確認してみました。以下のページを参考にしました。

https://elixirschool.com/ja/lessons/basics/enum

# 対話モードで実行
以下のコマンドを実行しました。
```
$ iex
Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]

Interactive Elixir (1.12.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Enum.__info__(:functions) |> Enum.each(fn({function, arity}) ->
...(1)> IO.puts "#{function}/#{arity}"
...(1)> end)
all?/1
all?/2
any?/1
any?/2
at/2
at/3
chunk/2
chunk/3
chunk/4
chunk_by/2
chunk_every/2
chunk_every/3
chunk_every/4
chunk_while/4
concat/1
concat/2
count/1
count/2
count_until/2
count_until/3
dedup/1
dedup_by/2
drop/2
drop_every/2
drop_while/2
each/2
empty?/1
fetch/2
fetch!/2
filter/2
filter_map/3
find/2
find/3
find_index/2
find_value/2
find_value/3
flat_map/2
flat_map_reduce/3
frequencies/1
frequencies_by/2
group_by/2
group_by/3
intersperse/2
into/2
into/3
join/1
join/2
map/2
map_every/3
map_intersperse/3
map_join/2
map_join/3
map_reduce/3
max/1
max/2
max/3
max_by/2
max_by/3
max_by/4
member?/2
min/1
min/2
min/3
min_by/2
min_by/3
min_by/4
min_max/1
min_max/2
min_max_by/2
min_max_by/3
min_max_by/4
partition/2
product/1
random/1
reduce/2
reduce/3
reduce_while/3
reject/2
reverse/1
reverse/2
reverse_slice/3
scan/2
scan/3
shuffle/1
slice/2
slice/3
sort/1
sort/2
sort_by/2
sort_by/3
split/2
split_while/2
split_with/2
sum/1
take/2
take_every/2
take_random/2
take_while/2
to_list/1
uniq/1
uniq/2
uniq_by/2
unzip/1
with_index/1
with_index/2
zip/1
zip/2
zip_reduce/3
zip_reduce/4
zip_with/2
zip_with/3
:ok
iex(2)> Enum.all?(["foo", "bar", "hello"], fn(s) -> String.length(s) == 3 end)
false
iex(3)> Enum.all?(["foo", "bar", "hello"], fn(s) -> String.length(s) > 1 end)
true
iex(4)> Enum.any?(["foo", "bar", "hello"], fn(s) -> String.length(s) == 5 end)
true
iex(5)> Enum.chunk_every([1, 2, 3, 4, 5, 6], 2)
[[1, 2], [3, 4], [5, 6]]
iex(6)> Enum.chunk_by(["one", "two", "three", "four", "five"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"]]
iex(7)> Enum.chunk_by(["one", "two", "three", "four", "five", "six"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"], ["six"]]
iex(8)> Enum.map_every([1, 2, 3, 4, 5, 6, 7, 8], 3, fn x -> x + 1000 end)
[1001, 2, 3, 1004, 5, 6, 1007, 8]
iex(9)> Enum.each(["one", "two", "three"], fn(s) -> IO.puts(s) end)
one
two
three
:ok
iex(10)> Enum.map([0, 1, 2, 3], fn(x) -> x - 1 end)
[-1, 0, 1, 2]
iex(11)> Enum.min([5, 3, 0, -1])
-1
iex(12)> Enum.min([], fn -> :foo end)
:foo
iex(13)> Enum.max([5, 3, 0, -1])
5
iex(14)> Enum.max([], fn -> :bar end)
:bar
iex(15)> Enum.filter([1, 2, 3, 4], fn(x) -> rem(x, 2) == 0 end)
[2, 4]
iex(16)> Enum.reduce([1, 2, 3], 10, fn(x, acc) -> x + acc end)
16
iex(17)> Enum.reduce([1, 2, 3], fn(x, acc) -> x + acc end)
6
iex(18)> Enum.reduce(["a","b","c"], "1", fn(x,acc)-> x <> acc end)
"cba1"
iex(19)> Enum.sort([5, 6, 1, 3, -1, 4])
[-1, 1, 3, 4, 5, 6]
iex(20)> Enum.sort([:foo, "bar", Enum, -1, 4])
[-1, 4, Enum, :foo, "bar"]
iex(21)> Enum.sort([%{:val => 4}, %{:val => 1}], fn(x, y) -> x[:val] > y[:val] end)
[%{val: 4}, %{val: 1}]
iex(22)> Enum.sort([%{:count => 4}, %{:count => 1}])
[%{count: 1}, %{count: 4}]
iex(23)> Enum.sort([2, 3, 1], :desc)
[3, 2, 1]
iex(24)> Enum.uniq([1, 2, 3, 2, 1, 1, 1, 1, 1])
[1, 2, 3]
iex(25)> Enum.uniq_by([%{x: 1, y: 1}, %{x: 2, y: 1}, %{x: 3, y: 3}], fn coord -> coord.y end)
[%{x: 1, y: 1}, %{x: 3, y: 3}]
iex(26)> Enum.map([1,2,3], fn number -> number + 3 end)
[4, 5, 6]
iex(27)> Enum.map([1,2,3], &(&1 + 3))
[4, 5, 6]
iex(28)> plus_three = &(&1 + 3)
#Function<44.65746770/1 in :erl_eval.expr/5>
iex(29)> Enum.map([1,2,3], plus_three)
[4, 5, 6]
iex(30)> defmodule Adding do
...(30)>   def plus_three(number), do: number + 3
...(30)> end
{:module, Adding,
 <<70, 79, 82, 49, 0, 0, 4, 248, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 145,
   0, 0, 0, 15, 13, 69, 108, 105, 120, 105, 114, 46, 65, 100, 100, 105, 110,
   103, 8, 95, 95, 105, 110, 102, 111, 95, 95, ...>>, {:plus_three, 1}}
iex(31)> Enum.map([1,2,3], fn number -> Adding.plus_three(number) end)
[4, 5, 6]
iex(32)> Enum.map([1,2,3], &Adding.plus_three(&1))
[4, 5, 6]
iex(33)> Enum.map([1,2,3], &Adding.plus_three/1)
[4, 5, 6]
iex(34)> 
```

# まとめ
何かの役に立てばと。