Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
princemaple committed Sep 4, 2018
1 parent 6958c74 commit 9ae7401
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,36 @@ iex> Enum.to_list Qex.join(q1, q2)
[1, 2, 3, 4, 5]
```

#### Return the first item

```elixir
iex> q1 = Qex.new 1..3
iex> Qex.first(q1)
{:value, 1}
iex> q2 = Qex.new []
iex> Qex.first(q2)
:empty

iex> q1 = Qex.new 1..3
iex> Qex.first!(q1)
1
```

#### Return the last item

```elixir
iex> q1 = Qex.new 1..3
iex> Qex.last(q1)
{:value, 3}
iex> q2 = Qex.new []
iex> Qex.last(q2)
:empty

iex> q1 = Qex.new 1..3
iex> Qex.last!(q1)
3
```

## Why not "Queue"?

The name is taken... [Hex link](https://hex.pm/packages/queue)

0 comments on commit 9ae7401

Please sign in to comment.