Skip to content

Commit 9ae7401

Browse files
committed
update readme
1 parent 6958c74 commit 9ae7401

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,36 @@ iex> Enum.to_list Qex.join(q1, q2)
136136
[1, 2, 3, 4, 5]
137137
```
138138

139+
#### Return the first item
140+
141+
```elixir
142+
iex> q1 = Qex.new 1..3
143+
iex> Qex.first(q1)
144+
{:value, 1}
145+
iex> q2 = Qex.new []
146+
iex> Qex.first(q2)
147+
:empty
148+
149+
iex> q1 = Qex.new 1..3
150+
iex> Qex.first!(q1)
151+
1
152+
```
153+
154+
#### Return the last item
155+
156+
```elixir
157+
iex> q1 = Qex.new 1..3
158+
iex> Qex.last(q1)
159+
{:value, 3}
160+
iex> q2 = Qex.new []
161+
iex> Qex.last(q2)
162+
:empty
163+
164+
iex> q1 = Qex.new 1..3
165+
iex> Qex.last!(q1)
166+
3
167+
```
168+
139169
## Why not "Queue"?
140170

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

0 commit comments

Comments
 (0)