Liking cljdoc? Tell your friends :D

naga.queue

Defines a Queue structure that can be added to the tail, and removed from the head. Anything already in the queue (compared by ID) will not be added again, but a function can be provided that will update the element when it is already present. Includes a 'salience' which allows elements to be promoted through the queue ahead of less salient elements.

Defines a Queue structure that can be added to the tail, and removed from the head.
Anything already in the queue (compared by ID) will not be added again, but a function can
be provided that will update the element when it is already present.
Includes a 'salience' which allows elements to be promoted through the queue ahead
of less salient elements.
raw docstring

drainclj/s

(drain queue)

Pulls everything off a queue into a seq.

Pulls everything off a queue into a seq.
sourceraw docstring

insert-byclj/s

(insert-by s salience elt)

Inputs: [s :- [s/Any] salience :- (s/maybe (=> s/Num s/Any)) elt :- s/Any] Returns: [s/Any]

Insert an element into a sequence, by salience. If a salience function is provided, then insert the element immediately after all elements of lower salience. If no salience is provided, then append the element to the end of the seq

Inputs: [s :- [s/Any] salience :- (s/maybe (=> s/Num s/Any)) elt :- s/Any]
Returns: [s/Any]

Insert an element into a sequence, by salience.
 If a salience function is provided, then insert the element immediately after all elements
 of lower salience.
 If no salience is provided, then append the element to the end of the seq
sourceraw docstring

new-queueclj/s≠

clj
(new-queue)
(new-queue salience-fn id-fn)
cljs
(new-queue)
(new-queue G__8091 G__8092)

Inputs: ([] [salience-fn :- (s/maybe (=> s/Num s/Any)) id-fn :- (=> s/Any s/Any)])

Create an empty queue. When called without arguments, salience is ignored, and update and ID are just identity.

Inputs: ([] [salience-fn :- (s/maybe (=> s/Num s/Any)) id-fn :- (=> s/Any s/Any)])

Create an empty queue. When called without arguments, salience is ignored,
 and update and ID are just identity.
sourceraw docstring

PQueueclj/s≠protocol

addclj/s

(add queue element)
(add queue update-fn element)

Adds an element to the queue if it isn't already present, returning the new queue. Uses update-fn on the element if it is already in the queue

Adds an element to the queue if it isn't already present, returning the new queue.
Uses update-fn on the element if it is already in the queue

headclj/s

(head queue)

Returns the head of the queue

Returns the head of the queue

popclj/s

(pop queue)

Removes the head from the queue

Removes the head from the queue

q-countclj/s

(q-count queue)

Returns the number of items in the queue

Returns the number of items in the queue
source

PQueueTypeclj/s

source

SalienceQueuecljs

source

strict-map->SalienceQueueclj/s≠

clj
(strict-map->SalienceQueue m4037 & [drop-extra-keys?__681__auto__])
cljs
(strict-map->SalienceQueue m8063 & [drop-extra-keys?__681__auto__])

Factory function for class SalienceQueue, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->

Factory function for class SalienceQueue, taking a map of keywords to field values.  All keys are required, and no extra keys are allowed.  Even faster than map->
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close