Re: Decent datastructure for queue operations
- From: Russell McManus <russell_mcmanus@xxxxxxxxx>
- Date: Mon, 30 Jan 2006 15:57:55 -0500
Kenny Tilton <NOktiltonSPAM@xxxxxxxxxx> writes:
> Here is mine:
>
> (defun make-fifo-queue () (cons nil nil))
> (defun fifo-add (q new)
> (if (car q)
> (let ((last (cdr q))
> (newlast (list new)))
> (rplacd last newlast)
> (rplacd q newlast))
> (let ((newlist (list new)))
> (rplaca q newlist)
> (rplacd q newlist))))
> (defun fifo-queue (q) (car q))
> (defun fifo-empty-p (q) (not (car q)))
> (defun fifo-pop (q)
> (prog1
> (caar q)
> (rplaca q (cdar q))))
>
> (defun mapfifo (fn q)
> (loop until (fifo-empty q)
> do (funcall fn (fifo-pop q))))
Yours is definitely less filling, but mine tastes great with CLOS.
PRINT-OBJECT, :around methods, yum.
-russ
.
- References:
- Decent datastructure for queue operations
- From: meng
- Re: Decent datastructure for queue operations
- From: Russell McManus
- Re: Decent datastructure for queue operations
- From: Kenny Tilton
- Decent datastructure for queue operations
- Prev by Date: Re: Interesting developments since "Beating the averages"?
- Next by Date: Re: Interesting developments since "Beating the averages"?
- Previous by thread: Re: Decent datastructure for queue operations
- Next by thread: Re: Decent datastructure for queue operations
- Index(es):