Previous: , Up: psqs   [Contents][Index]


6.4 Ranged query functions

Function: psq-at-most PSQ PRIORITY

Return an alist containing all the associations in PSQ with priority less than, or equal to, the given PRIORITY. The returned alist is ordered by key according to the predicate for PSQ.

(let* ((Q (make-psq key< priority<))
       (Q (psq-set Q "salut" 2))
       (Q (psq-set Q "hello" 1))
       (Q (psq-set Q "ciao"  4))
       (Q (psq-set Q "ohayo" 3)))
  (psq-at-most Q 2))
⇒ (("hello" . 1) ("salut" . 2))
Function: psq-at-most-range PSQ PRIORITY MIN-KEY MAX-KEY

Similar to psq-at-most, but it also takes an upper and lower bound, for the keys it will return. These bounds are inclusive.

(let* ((Q (make-psq key< priority<))
       (Q (psq-set Q "salut" 1))
       (Q (psq-set Q "hello" 2))
       (Q (psq-set Q "ciao"  2))
       (Q (psq-set Q "ohayo" 2)))
  (psq-at-most-range Q 2 "hello" "salut"))
⇒ (("hello" . 2) ("ohayo" . 2) ("salut" . 1))

Previous: , Up: psqs   [Contents][Index]

This document describes version 0.5.0-devel.1 of MMCK PFDS.