Skip to content

Commit

Permalink
Added an example demonstrating handling of duplicates in list substra…
Browse files Browse the repository at this point in the history
…ction (elixirschool#612)
  • Loading branch information
Slotos authored and ybur-yug committed Aug 29, 2016
1 parent 48936dc commit ead1436
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lessons/basics/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ iex> ["foo", :bar, 42] -- [42, "bar"]
["foo", :bar]
```

Be mindful of duplicate values. For every element on the right, the first occurence of it gets removed from the left:

```elixir
iex> [1,2,2,3,2,3] -- [1,2,3,2]
[2, 3]
```

**Note:** It uses [strict comparison](../basics/#comparison) to match the values.

### Head / Tail
Expand Down

0 comments on commit ead1436

Please sign in to comment.