Logo

Programming-Idioms

History of Idiom 118 > diff from v41 to v42

Edit summary for version 42 by programming-idioms.org:
[Elixir] Dead link: play.elixirbyexample.com has been down for a while

Version 41

2019-09-29, 11:36:29

Version 42

2019-10-14, 12:28:16

Idiom #118 List to set

Create set y from list x.
x may contain duplicates. y is unordered and has no repeated values.

Illustration

Idiom #118 List to set

Create set y from list x.
x may contain duplicates. y is unordered and has no repeated values.

Illustration
Code
y = x |> Enum.uniq |> List.to_tuple
Code
y = x |> Enum.uniq |> List.to_tuple
Comments bubble
Remove list duplication and convert to a tuple.

Warning: a tuple is not really a set.
Comments bubble
Remove list duplication and convert to a tuple.

Warning: a tuple is not really a set.
Doc URL
http://elixir-lang.org/docs/stable/elixir/List.html#to_tuple/1
Doc URL
http://elixir-lang.org/docs/stable/elixir/List.html#to_tuple/1
Demo URL
http://play.elixirbyexample.com/s/717f59186a