hraban / cl-containers

Containers Library for Common Lisp
http://common-lisp.net/project/cl-containers/
Other
65 stars 13 forks source link

Add LIFO-INDEX, LIFO-REF, RECENT-LIST, and DELETE-ITEM functions. #11

Closed solbloch closed 5 years ago

solbloch commented 5 years ago

Change the ring-buffer class to be LIFO (Last In First Out).

I added LIFO-like methods, but didn't yet remove the FIFO methods. I think they are funky and should be removed, pending approval.

Ambrevar commented 5 years ago

Cool!

So you've added new methods parallel to the existing methods, I didn't think of that :p This is interesting: for the same structure, we could have both LIFO and FIFO access. But is it really what we want?

I'm not sure what the next-item method is for, I'd guess it's for the iterators. If that's the case, we would need an iterator for LIFO order as well.

About the PR: I would separate this patch set into 3 commits at least:

  1. Re-indent everything.
  2. Add the LIFO methods.
  3. Add the delete-item function.

With the re-indentation in the way it's not so obvious to see what has changed and what hasn't.