# HG changeset patch # User Steve Losh # Date 1575826146 18000 # Node ID f3327aa93670be7e50f2c7f1ccb0374de029b64d # Parent 2309743a485d1a0f9da6ac7a94f70a6cea7675dd Add `:initial-contents` for `make-queue` diff -r 2309743a485d -r f3327aa93670 src/queues.lisp --- a/src/queues.lisp Fri Dec 06 21:04:10 2019 -0500 +++ b/src/queues.lisp Sun Dec 08 12:29:06 2019 -0500 @@ -10,7 +10,7 @@ (declaim - (ftype (function () + (ftype (function (&key (:initial-contents list)) (values queue &optional)) make-queue) (ftype (function (queue) @@ -27,9 +27,12 @@ queue-append)) -(defun-inlineable make-queue () +(defun-inlineable make-queue (&key initial-contents) "Allocate and return a fresh queue." - (make-queue%)) + (let ((queue (make-queue%))) + (when initial-contents + (queue-append queue initial-contents)) + queue)) (defun-inlineable queue-empty-p (queue) "Return whether `queue` is empty."