ruricolist / serapeum

Utilities beyond Alexandria
MIT License
425 stars 42 forks source link

Really need `back` method for `queue`! #67

Closed minghu6 closed 4 years ago

minghu6 commented 4 years ago

Some times, maybe more frequently, you really need get the tail element of the queue. Though, I can write my own version as a workaround:

(defun back (serapeum-queue)
  (alexandria:last-elt (qlist serapeum-queue)))

Supply a back method for queue from serapeum is the better way. since there is already a front method:

https://github.com/ruricolist/serapeum/blob/408abccd519254efe877d49aeb4c2b912bd0ffc0/queue.lisp#L146

ruricolist commented 4 years ago

That's a good idea and it can be done in constant time (without traversing the list).

minghu6 commented 4 years ago

En.., So, add enhancement label for this issue?