ruricolist / serapeum

Utilities beyond Alexandria
MIT License
425 stars 42 forks source link

Use queue like a sequence? #69

Open minghu6 opened 4 years ago

minghu6 commented 4 years ago

During working with queue, I found it's unconvenient for there is no iteration interface for queue.

In many times, I have to follow the flow:

myqueue: 
=> (qlist myqueue) 
=> operating on sequence... 
=> (apply 'queue mysequnce)

Required API: qiter, qinto corresponds to map on first level of queue. qwalk, qmap corresponds to map on the whole queue tree. qlist-1, qlist corresponds to old qlist and qlist-1 for all level.

Or It's better to impl sequnce method for queue, for example http://research.gold.ac.uk/2344/1/sequences-20070301.pdf

ruricolist commented 4 years ago

Serapeum uses queues internally to implement higher-level sequence functions, so I need to keep them as simple and efficient as possible -- which is why they are structures and not CLOS classes, which they would have to be to support the sequence protocol. (Note also that Serapeum officially supports CCL, which doesn't implement the sequence protocol.)

But it would be nice to provide a more convenient way of iterating over queues.

minghu6 commented 4 years ago

I'm surpressed that not all lisp-impl support sequence protocol. A decent impl should supply a way to supply user extensible sequence.

Sigh, dead language standard let common lisp not common (sadly).