Skip to content

Commit

Permalink
update documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
fr33m0nk committed Apr 4, 2024
1 parent 8332367 commit 223c8d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/data_structures/queue/list.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
(drop-last 1 queue)))

(defn peek-queue
"this implementation is more performant than using `last` or `reverse`
they both traverse the entire collection whereas count is stored on the PersistenceList object"
[queue]
(when-not (empty? queue)
(nth queue (dec (count queue)))))
Expand Down

0 comments on commit 223c8d2

Please sign in to comment.