Logo

Programming-Idioms

History of Idiom 118 > diff from v18 to v19

Edit summary for version 19 by programming-idioms.org:
[Elixir] +DemoURL. +Warning

Version 18

2016-11-30, 20:34:36

Version 19

2016-11-30, 20:55:17

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
x |> Enum.uniq |> List.to_tuple
Code
x |> Enum.uniq |> List.to_tuple
Comments bubble
Remove list duplication and convert to a tuple that has no ordering.
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