A brief description of every exported name in every library of the pfds namespace of r7rs-libs.
(pfds bounded-balance-tree)
- Definition
-
(make-bbtree key<?)
- Description
-
-
key<?
- ordering procedure for keys
-
Returns an empty bounded balance tree.
- Error
-
If
key<?
is not a procedure.
- Definition
-
(bbtree? object)
- Description
-
-
object
- any value
-
Returns #t
if the object is a bounded balance tree instance.
- Definition
-
(bbtree-size bbtree)
- Description
-
-
bbtree
- a bounded balance tree instance
-
Returns the number of elements in the bounded balance tree.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-ref bbtree key [default])
- Description
-
-
bbtree
- a bounded balance tree instance -
key
- any value -
default
- an optional value
-
Returns the value associated with the key in the bounded balance tree. If the key is not in the tree then the optional default value is returned or, if not present, an error is raised.
- Error
-
If
bbtree
is not a bounded balance tree instance, orkey
is not in tree and nodefault
provided.
- Definition
-
(bbtree-set bbtree key value)
- Description
-
-
bbtree
- a bounded balance tree instance -
key
- any value -
value
- any value
-
Returns a new bounded balance tree with the key associated with the value. If the key is already in the bounded balance tree, its associated value is replaced with the new value in the returned bounded balance tree.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-update bbtree key proc default)
- Description
-
-
bbtree
- a bounded balance tree instance -
key
- any value -
proc
- an update procedure on the key value -
default
- any value
-
Returns a new bounded balance tree with the value associated with the key updated according to the update procedure. If the key was not already in the bounded balance tree, the update procedure is called on the default value, and the association is added to the bounded balance tree.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-delete bbtree key)
- Description
-
-
bbtree
- a bounded balance tree instance -
key
- any value
-
Returns a new bounded balance tree with the key and its associated value removed. If the key is not in the bounded balance tree, then the returned tree is a copy of the original.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-contains? bbtree key)
- Description
-
-
bbtree
- a bounded balance tree instance -
key
- any value
-
Returns #t
if there is an association for the given key in the bounded
balance tree, #f
otherwise.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-ordering-procedure bbtree)
- Description
-
-
bbtree
- a bounded balance tree instance
-
Returns the ordering procedure used internally to order the bounded balance tree.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-traverse traverser base bbtree)
- Description
-
-
traverser
- traversal procedure takes five parameters: the current node’s key and value, procedures for traversing the left and right subtrees, and a base value -
base
- any value -
bbtree
- a bounded balance tree instance
-
A general tree traversal procedure. Returns the value of applying the traverser procedure to the current node’s key, value, a procedure to traverse the left subtree, a procedure to traverse the right subtree, and a base value. The subtree traversal procedures both take a base argument, and call bbtree-traverse recursively on the appropriate subtree. It is mostly useful for implementing other, more specific tree traversal procedures.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-fold combine base bbtree)
- Description
-
-
combiner
- combine procedure takes three parameters: the current node’s key and value and an accumulator value -
base
- any value -
bbtree
- a bounded balance tree instance
-
Returns the value obtained by the iterating the combine procedure over each node in the tree. The combine procedure takes three arguments, the key and value of the current node, and an accumulator value, and its return value is used as the accumulator value for the next node. The initial accumulator value is provided by the base argument. bbtree-fold performs an left-to-right in-order traversal or "minimum key to maximum key".
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-fold-right combine base bbtree)
- Description
-
-
combiner
- combine procedure takes three parameters: the current node’s key and value and an accumulator value -
base
- any value -
bbtree
- a bounded balance tree instance
-
Returns the value obtained by the iterating the combine procedure over each node in the tree. The combine procedure takes three arguments, the key and value of the current node, and an accumulator value, and its return value is used as the accumulator value for the next node. The initial accumulator value is provided by the base argument. bbtree-fold performs a right-to-left in-order traversal or "maximum key to minimum key".
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-map mapper bbtree)
- Description
-
-
mapper
- procedure mapping any value to another value -
bbtree
- a bounded balance tree instance
-
Returns the tree obtained by updating the value of each node with the result of applying the mapping procedure to its value.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree→alist bbtree)
- Description
-
-
bbtree
- a bounded balance tree instance
-
Returns the key-value associations of the bounded balance tree as a list of pairs. The list returned is in sorted order, according to the ordering procedure of the bounded balance tree.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(alist→bbtree lst key<?)
- Description
-
-
lst
- a list of key-value pairs -
key<?
- a comparison procedure for keys
-
Returns a bounded balance tree containing each of the key-value pairs in the association list, using the given comparison procedure for ordering.
- Definition
-
(bbtree-keys bbtree)
- Description
-
-
bbtree
- a bounded balance tree instance
-
Returns a list containing all the keys of the bounded balance tree. The keys are sorted according to the bounded balance tree’s ordering procedure.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-union bbtree-1 bbtree-2)
- Description
-
-
bbtree-1
- a bounded balance tree instance -
bbtree-2
- a second bounded balance tree instance
-
Returns a bounded balance tree containing the union of the assications in
the two trees. The ordering procedure from bbtree-1
is used in the result,
and duplicate keys are given the value in bbtree-1
.
- Error
-
If
bbtree-1
orbbtree-2
is not a bounded balance tree instance.
- Definition
-
(bbtree-difference bbtree-1 bbtree-2)
- Description
-
-
bbtree-1
- a bounded balance tree instance -
bbtree-2
- a second bounded balance tree instance
-
Returns a bounded balance tree containing all of the assications in bbtree-1
which do not occur in bbtree-2
.
- Error
-
If
bbtree-1
orbbtree-2
is not a bounded balance tree instance.
- Definition
-
(bbtree-intersection bbtree-1 bbtree-2)
- Description
-
-
bbtree-1
- a bounded balance tree instance -
bbtree-2
- a second bounded balance tree instance
-
Returns a bounded balance tree containing all of the associations which appear
in both bbtree-1
and bbtree-2
; the value in bbtree-1
is preferred over
that in bbtree-2
.
- Error
-
If
bbtree-1
orbbtree-2
is not a bounded balance tree instance.
- Definition
-
(bbtree-index bbtree key)
- Description
-
-
bbtree
- a bounded balance tree instance -
key
- any value
-
Returns the index of the key in the bounded balance tree. Index is an integer between 0 and size-1, with a key having a lower index than a second if first-key < second-key, according to the bounded balance tree ordering procedure.
- Error
-
If
bbtree
is not a bounded balance tree instance.
- Definition
-
(bbtree-ref/index bbtree index)
- Description
-
-
bbtree
- a bounded balance tree instance -
index
- a positive number
-
Returns the key and value of the association in the bounded balance tree at the given index.
- Error
-
If
bbtree
is not a bounded balance tree instance, orindex
is not valid.
(pfds deque)
- Definition
-
(make-deque)
- Description
-
Returns a deque containing no items.
- Definition
-
(deque? object)
- Description
-
-
object
- any value
-
Returns #t
if object is a deque.
- Definition
-
(deque-length deque)
- Description
-
-
deque
- a deque instance
-
Returns the number of items in the deque.
- Error
-
If
deque
is not a deque instance.
- Definition
-
(deque-empty? deque)
- Description
-
-
deque
- a deque instance
-
Returns #t
if there are no items in the deque.
- Error
-
If
deque
is not a deque instance.
- Definition
-
(enqueue-front deque item)
- Description
-
-
deque
- a deque instance -
item
- any value
-
Returns a new deque with the inserted item at the front.
- Error
-
If
deque
is not a deque instance.
- Definition
-
(enqueue-rear deque item)
- Description
-
-
deque
- a deque instance -
item
- any value
-
Returns a new deque with the inserted item at the rear.
- Error
-
If
deque
is not a deque instance.
- Definition
-
(dequeue-front deque)
- Description
-
-
deque
- a deque instance
-
Returns two values, the item at the front of the deque, and a new deque containing all the other items.
- Error
-
If
deque
is not a deque instance, or is empty.
- Definition
-
(dequeue-rear deque)
- Description
-
-
deque
- a deque instance
-
Returns two values, the item at the rear of the deque, and a new deque containing all the other items.
- Error
-
If
deque
is not a deque instance, or is empty.
- Definition
-
(deque→list deque)
- Description
-
-
deque
- a deque instance
-
Returns a list containing all the elements of the deque, in the order they would be in if dequeued from the front of the deque.
- Error
-
If
deque
is not a deque instance.
- Definition
-
(list→deque list-items)
- Description
-
-
list-items
- list of values
-
Returns a deque containing all of the elements in the list in order.
(pfds difference-list)
- Definition
-
(dlist element …)
- Description
-
-
element
- any value
-
Returns a difference list containing all the given elements.
- Definition
-
(dlist? object)
- Description
-
-
object
- any value
-
Returns #t
if object is a difference list.
- Definition
-
(dlist-cons element dlist)
- Description
-
-
element
- any value -
dlist
- a difference list instance
-
Returns a new difference list created by prepending the given element to the head of the difference list.
- Error
-
If
dlist
is not a difference list instance.
- Definition
-
(dlist-snoc dlist element)
- Description
-
-
dlist
- a difference list instance -
element
- any value
-
Returns a new difference list created by appending the given element to the tail of the difference list.
- Error
-
If
dlist
is not a difference list instance.
- Definition
-
(dlist-append dlist-1 dlist-2)
- Description
-
-
dlist-1
- a difference list instance -
dlist-2
- a second difference list instance
-
Returns a new difference list consisting of all the elements of
dlist-1
followed by all the elements of dlist-2
.
- Error
-
If
dlist-1
ordlist-2
is not a difference list instance.
- Definition
-
(dlist→list dlist)
- Description
-
-
dlist
- a difference list instance
-
Returns a list consisting of all the elements of the difference list.
- Error
-
If
dlist
is not a difference list instance.
- Definition
-
(list→dlist list-items)
- Description
-
-
list-items
- list of values
-
Returns a difference list consisting of all the elements of the list.
(pfds fector)
- Definition
-
(make-fector size [fill])
- Description
-
-
size
- positive integer -
fill
- optional value
-
Returns a fector of the specified size. If fill
is provided, then
the locations of the fector are initialised to that object.
- Definition
-
(fector element …)
- Description
-
-
element
- any value
-
Returns a fector whose initial values are the given elements.
- Definition
-
(fector? object)
- Description
-
-
object
- any value
-
Returns #t
if object is a fector instance.
- Definition
-
(fector-length fector)
- Description
-
-
fector
- a fector instance
-
Returns the number of elements that are stored in the fector.
- Error
-
If
fector
is not a fector instance.
- Definition
-
(build-fector size proc)
- Description
-
-
size
- a positive number -
proc
- a procedure taking a number and returning a value
-
Returns a new fector of the given size, where each element is initialised to the value of the given procedure applied to its index.
- Definition
-
(fector-ref fector index)
- Description
-
-
fector
- a fector instance -
index
- a positive number
-
Returns the value associated with the given index in the fector.
- Error
-
If
fector
is not a fector instance, or ifindex
is not valid.
- Definition
-
(fector-set fector index element)
- Description
-
-
fector
- a fector instance -
index
- a positive number -
element
- any value
-
Returns a new fector equivalent to the given one except the given index is now associated with the given element.
- Error
-
If
fector
is not a fector instance, or ifindex
is not valid.
- Definition
-
(list→fector list-items)
- Description
-
-
list-items
- list of values
-
Returns a fector initialised with the contents of the given list.
- Definition
-
(fector→list fector)
- Description
-
-
fector
- a fector instance
-
Returns a list containing the elements in a given fector.
- Error
-
If
fector
is not a fector instance.
(pfds fingertree)
- Definition
-
(fingertree? object)
- Description
-
-
object
- any value
-
Returns #t
if object is a fingertree.
- Definition
-
(fingertree-empty? fingertree)
- Description
-
-
fingertree
- a fingertree instance
-
Returns #t
if there are no items in the given fingertree.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(make-fingertree id combine measure)
- Description
-
-
id
- measure of an empty fingertree -
combine
- procedure combining two given values into one -
measure
- measure of a fingertree
-
Returns a new fingertree, parameterised by the given monoid.
- Definition
-
(fingertree-cons element fingertree)
- Description
-
-
element
- any value -
fingertree
- a fingertree instance
-
Returns a new fingertree created by adding the given element to the front of the given fingertree.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-snoc fingertree element)
- Description
-
-
fingertree
- a fingertree instance -
element
- any value
-
Returns a new fingertree created by adding the given element to the end of the given fingertree.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-uncons fingertree)
- Description
-
-
fingertree
- a fingertree instance
-
Returns two values: the element at the front of the fingertree, and a new fingertree containing all but the front element.
- Error
-
If
fingertree
is not a fingertree instance, or is empty.
- Definition
-
(fingertree-unsnoc fingertree)
- Description
-
-
fingertree
- a fingertree instance
-
Returns two values: a new fingertree containing all but the rear element, and the element at the rear of the fingertree.
- Error
-
If
fingertree
is not a fingertree instance, or is empty.
- Definition
-
(fingertree-append fingertree-1 fingertree-2)
- Description
-
-
fingertree-1
- a fingertree instance -
fingertree-2
- a second fingertree instance
-
Returns a new fingertree which contains all of the elements of the first fingertree, followed by all the elements of the second. The two fingertrees are assumed to be parameterised by the same monoid.
- Error
-
If
fingertree-1
orfingertree-2
is not a fingertree instance.
- Definition
-
(list→fingertree list-items id combine measure)
- Description
-
-
list-items
- a list of values -
id
- measure of an empty fingertree -
combine
- procedure combining two given values into one -
measure
- measure of a fingertree
-
Returns a new fingertree containing all the elements of the given list, parameterised by the given three procedures.
- Definition
-
(fingertree→list fingertree)
- Description
-
-
fingertree
- a fingertree instance
-
Returns a list of all the elements in the fingertree, in the order in which they would be unconsed.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-measure fingertree)
- Description
-
-
fingertree
- a fingertree instance
-
Returns the measure of the given fingertree.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-split proc fingertree)
- Description
-
-
proc
- a predicate -
fingertree
- a fingertree instance
-
Returns two values: the first is the largest prefix of the fingertree for which
applying the predicate to its accumulated measure returns #f
. The second
value is a fingertree containing all those elements not in the first
fingertree.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-split3 proc fingertree)
- Description
-
-
proc
- a predicate -
fingertree
- a fingertree instance
-
Returns three values: the first is the largest prefix of the fingertree for
which applying the predicate to its accumulated measure returns #f
. The
second value is the head of those elements not in the first fingertree, and the
third value is a fingertree containing the tail.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-fold proc base fingertree)
- Description
-
-
proc
- combiner procedure takes two arguments, current value and accumulator -
base
- initial value for accumulator -
fingertree
- a fingertree instance
-
Returns the value obtained by iterating the combiner procedure over the fingertree in left-to-right order.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-fold-right proc base fingertree)
- Description
-
-
proc
- combiner procedure takes two arguments, current value and accumulator -
base
- initial value for accumulator -
fingertree
- a fingertree instance
-
Returns the value obtained by iterating the combiner procedure over the fingertree in right-to-left order.
- Error
-
If
fingertree
is not a fingertree instance.
- Definition
-
(fingertree-reverse fingertree)
- Description
-
-
fingertree
- a fingertree instance
-
Returns a new fingertree in which the elements are in the opposite order from the given fingertree.
- Error
-
If
fingertree
is not a fingertree instance.
(pfds hash-array-mapped-trie)
- Definition
-
(make-hamt hash eqv?)
- Description
-
-
hash
- a hashing function -
eqv?
- an equivalence function
-
Returns a new empty hamt using the given hash and equivalence functions.
- Definition
-
(hamt? object)
- Description
-
-
object
- any value
-
Returns #t
if the object is a hamt instance.
- Definition
-
(hamt-size hamt)
- Description
-
-
hamt
- a hamt instance
-
Returns the number of associations in the hamt.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-ref hamt key [default])
- Description
-
-
hamt
- a hamt instance -
key
- any value -
default
- optional default value
-
Returns the value associated with the key in the hamt. If there is no value associated with the key, returns default, if given, or raises error, if not.
- Error
-
If
hamt
is not a hamt instance, or akey
is used with no value ordefault
.
- Definition
-
(hamt-set hamt key value)
- Description
-
-
hamt
- a hamt instance -
key
- any value -
value
- any value
-
Returns a new hamt with the key assiciated to the value. If the key is already associated with a value, it is replaced.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-update hamt key proc default)
- Description
-
-
hamt
- a hamt instance -
key
- any value -
proc
- update procedure, maps a value to another value -
default
- any value
-
Returns a new hamt with the value associated with the key updated by the update procedure. If the hamt does not have a value associated with the key, then the update procedure is applied to the default value, and the association added.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-delete hamt key)
- Description
-
-
hamt
- a hamt instance -
key
- any value
-
Returns a new hamt with the key and its associated value removed. If the key is not in the hamt, returns a copy of the original hamt.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-contains? hamt key)
- Description
-
-
hamt
- a hamt instance -
key
- any value
-
Returns #t
if there is an association for the key in the hamt, or #f
otherwise.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-equivalence-predicate hamt)
- Description
-
-
hamt
- a hamt instance
-
Returns the procedure used internally by the hamt to compare keys.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-hash-function hamt)
- Description
-
-
hamt
- a hamt instance
-
Returns the hash procedure used internally by the hamt.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-fold combine initial hamt)
- Description
-
-
combine
- a combine procedure accepting the key, value and current accumulated values, returning a new value -
initial
- initial value -
hamt
- a hamt instance
-
Returns value obtained by iterating the combine procedure over each key-value pair in the hamt. The traversal order is not guaranteed.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt-map mapper hamt)
- Description
-
-
mapper
- an update procedure for values -
hamt
- a hamt instance
-
Returns a new hamt obtained by applying the update procedure to each of the values in the hamt.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(hamt→alist hamt)
- Description
-
-
hamt
- a hamt instance
-
Returns the key/value associations of the hamt as a list of pairs. The order of the list is not guaranteed.
- Error
-
If
hamt
is not a hamt instance.
- Definition
-
(alist→hamt alist hash eqv?)
- Description
-
-
alist
- list of (key . value) pairs -
hash
- a hashing function -
eqv?
- an equivalence function
-
Returns a new hamt using the given hash and equivalence functions, filled with the key-value pairs. Repeated keys will have the left-most value.
(pfds heap)
- Definition
-
(make-heap priority<?)
- Description
-
-
priority<?
- an ordering procedure taking two arguments, returning a boolean
-
Returns a new empty heap using the ordering procedure.
- Definition
-
(heap priority<? value …)
- Description
-
-
priority<?
- an ordering procedure taking two arguments, returning a boolean -
value
- any value
-
Returns a new heap, using the ordering procedure, containing the given values as elements.
- Definition
-
(heap? object)
- Description
-
-
object
- any value
-
Returns #t
if the object is a heap instance.
- Definition
-
(heap-size heap)
- Description
-
-
heap
- a heap instance
-
Returns the number of elements in the heap.
- Error
-
If
heap
is not a heap instance.
- Definition
-
(heap-empty? heap)
- Description
-
-
heap
- a heap instance
-
Returns #t
if the heap contains no elements.
- Error
-
If
heap
is not a heap instance.
- Definition
-
(heap-min heap)
- Description
-
-
heap
- a heap instance
-
Returns the minimum element in the heap, according to the heap’s ordering procedure.
- Error
-
If
heap
is not a heap instance, or if the heap is empty.
- Definition
-
(heap-delete-min heap)
- Description
-
-
heap
- a heap instance
-
Returns a new heap containing all the elements of the heap except for the minimum element, according to the heap’s ordering procedure.
- Error
-
If
heap
is not a heap instance, or if the heap is empty.
- Definition
-
(heap-insert heap _value)
- Description
-
-
heap
- a heap instance -
value
- any value
-
Returns a new heap obtained by adding the given value to those in the heap.
- Error
-
If
heap
is not a heap instance.
- Definition
-
(heap-pop heap)
- Description
-
-
heap
- a heap instance
-
Returns two values, the minimum value in the heap, and a new heap obtained by removing the minimum value from the original heap.
- Error
-
If
heap
is not a heap instance, or if the heap is empty.
- Definition
-
(heap→list heap)
- Description
-
-
heap
- a heap instance
-
Returns a list containing all the elements of the heap. The list is ordered according to the heap’s ordering procedure.
- Error
-
If
heap
is not a heap instance.
- Definition
-
(list→heap list-items priority<?)
- Description
-
-
list-items
- a list of values -
priority<?
- an ordering procedure taking two arguments, returning a boolean
-
Returns a heap containing all the elements of the list using the ordering procedure.
- Definition
-
(heap-merge heap-1 heap-2)
- Description
-
-
heap-1
- a heap instance -
heap-2
- a second heap instance
-
Returns a new heap containing all the elements from the given two heaps. The heaps are assumed to be using the same ordering procedure.
- Error
-
If
heap-1
orheap-2
is not a heap instance.
- Definition
-
(heap-sort list-items priority<?)
- Description
-
-
list-items
- a list of values -
priority<?
- an ordering procedure taking two arguments, returning a boolean
-
Returns a new list that is a permutation of the given list, using the ordering procedure.
- Definition
-
(heap-ordering-procedure heap)
- Description
-
-
heap
- a heap instance
-
Returns the heap ordering procedure.
- Error
-
If
heap
is not a heap instance.
(pfds priority-search-queue)
- Definition
-
(make-psq key<? priority<?)
- Description
-
-
key<?
- ordering procedure for keys -
priority<?
- ordering procedure for priorities
-
Returns an empty priority search queue.
- Definition
-
(psq? object)
- Description
-
-
object
- any value
-
Returns #t
if the object is a priority search queue instance.
- Definition
-
(psq-empty? psq)
- Description
-
-
psq
- a priority search queue instance
-
Returns #t
if the priority search queue contains no elements.
- Error
-
If
psq
is not a heap instance.
- Definition
-
(psq-size psq)
- Description
-
-
psq
- a priority search queue instance
-
- Definition
-
(psq-ref psq key)
- Description
-
-
psq
- a priority search queue instance -
key
- any value
-
Returns the priority of a key if it is in the priority search queue.
- Error
-
If
psq
is not a priority search queue instance, or ifkey
is not in the priority search queue.
- Definition
-
(psq-set psq key priority)
- Description
-
-
psq
- a priority search queue instance -
key
- any value -
priority
- any value
-
Returns the priority search queue obtained from inserting a key with the given priority. If the key is already in the priority search queue, then its priority alue is updated.
- Error
-
If
psq
is not a priority search queue instance.
- Definition
-
(psq-set psq key function default)
- Description
-
-
psq
- a priority search queue instance -
key
- any value -
function
- a function mapping a priority value to a priority value -
default
- any value
-
Returns the priority search queue obtained by modifying the priority of a key by the given function. If the key is not in the priority search queue, then it is inserted with the priority obtained by calling the function on the default value.
- Error
-
If
psq
is not a priority search queue instance.
- Definition
-
(psq-delete psq key)
- Description
-
-
psq
- a priority search queue instance -
key
- any value
-
Returns the priority search queue obtained by removing the key-priority association from the priority search queue. If the key is not in the queue, then the returned search queue will be the same as the original.
- Error
-
If
psq
is not a priority search queue instance.
- Definition
-
(psq-contains? psq key)
- Description
-
-
psq
- a priority search queue instance -
key
- any value
-
Returns #t
if there is an association for the given key in the priority search queue, #f
otherwise.
- Error
-
If
psq
is not a priority search queue instance.
- Definition
-
(psq-min psq)
- Description
-
-
psq
- a priority search queue instance
-
Returns the key of the minimum association in the priority search queue.
- Error
-
If
psq
is not a priority search queue instance, orpsq
is empty.
- Definition
-
(psq-delete-min psq)
- Description
-
-
psq
- a priority search queue instance
-
Returns the priority search queue obtained by removing the minimum association in the priority search queue.
- Error
-
If
psq
is not a priority search queue instance, orpsq
is empty.
- Definition
-
(psq-pop psq)
- Description
-
-
psq
- a priority search queue instance
-
Returns two values: the minimum key and the priority search queue obtained by removing the minimum association from the original queue.
- Error
-
If
psq
is not a priority search queue instance, orpsq
is empty.
- Definition
-
(psq-at-most psq max-priority)
- Description
-
-
psq
- a priority search queue instance -
max-priority
- any value
-
Returns an alist containing all the associations in the priority
search queue with priority less than or equal to a given value. The
alist returned is ordered by key according to the predicate for the
psq
.
- Error
-
If
psq
is not a priority search queue instance.
- Definition
-
(psq-at-most-range psq max-priority min-key max-key)
- Description
-
-
psq
- a priority search queue instance -
max-priority
- any value -
min-key
- any value -
max-key
- any value
-
Returns an alist containing all the associations in the priority search queue
with priority less than or equal to a given value, with keys withing the given
(inclusive) bounds. The alist returned is ordered by key according to the
predicate for the psq
.
- Error
-
If
psq
is not a priority search queue instance.
(pfds queue)
- Definition
-
(make-queue)
- Description
-
Returns a queue containing no items.
- Definition
-
(queue? object)
- Description
-
-
object
- any value
-
Returns #t
if object is a queue.
- Definition
-
(queue-length queue)
- Description
-
-
queue
- a queue instance
-
Returns the number of items in the queue.
- Error
-
If
queue
is not a queue instance.
- Definition
-
(queue-empty? queue)
- Description
-
-
queue
- a queue instance
-
Returns #t
if the queue is empty.
- Error
-
If
queue
is not a queue instance.
- Definition
-
(enqueue queue item)
- Description
-
-
queue
- a queue instance -
item
- any value
-
Returns a new queue with the enqueued item at the end.
- Definition
-
(dequeue queue)
- Description
-
-
queue
- a queue instance
-
Returns two values, the item at the front of the queue, and a new queue containing all the other items.
- Error
-
If
queue
is not a queue instance, or is empty.
- Definition
-
(list→queue list-items)
- Description
-
-
list-items
- list of values
-
Returns a queue containing all of the elements in the list in order.
- Definition
-
(queue→list queue)
- Description
-
-
queue
- a queue instance
-
Returns a list containing all the elements of the queue, in the order they would be in if dequeued from the front of the queue.
- Error
-
If
queue
is not a queue instance.
(pfds sequence)
- Definition
-
(make-sequence)
- Description
-
Returns a new empty sequence.
- Definition
-
(sequence? object)
- Description
-
-
object
- any value
-
Returns #t
if the object is a sequence.
- Definition
-
(sequence-empty? sequence)
- Description
-
-
sequence
- a sequence instance
-
Returns #t
if the sequence contains no elements.
- Error
-
If
sequence
is not a sequence.
- Definition
-
(sequence-size sequence)
- Description
-
-
sequence
- a sequence instance
-
Returns the number of elements in the sequence.
- Error
-
If
sequence
is not a sequence.
- Definition
-
(sequence-cons value sequence)
- Description
-
-
value
- any value -
sequence
- a sequence instance
-
Returns a new sequence created by adding the value to the front of the sequence.
- Error
-
If
sequence
is not a sequence.
- Definition
-
(sequence-uncons sequence)
- Description
-
-
sequence
- a sequence instance
-
Returns two values, the first element of the sequence and a new sequence containing all but the first element.
- Error
-
If
sequence
is not a sequence or the sequence is empty.
- Definition
-
(sequence-snoc sequence value)
- Description
-
-
sequence
- a sequence instance -
value
- any value
-
Returns a new sequence created by adding the value to the end of the sequence.
- Error
-
If
sequence
is not a sequence.
- Definition
-
(sequence-unsnoc sequence)
- Description
-
-
sequence
- a sequence instance
-
Returns two values, a new sequence containing all but the last element and the last element itself.
- Error
-
If
sequence
is not a sequence or the sequence is empty.
- Definition
-
(sequence-append seq-1 seq-2)
- Description
-
-
seq-1
- a sequence instance -
seq-2
- a second sequence instance
-
Returns a new sequence containing all the elements of the first sequence followed by all the elements of the second sequence.
- Error
-
If
seq-1
orseq-2
is not a sequence.
- Definition
-
(list→sequence list-items)
- Description
-
-
list-items
- list of values
-
Returns a new sequence containing all the elements of the argument list, in the same order.
- Definition
-
(sequence→list sequence)
- Description
-
-
sequence
- a sequence instance
-
Returns a new list containing all the elements of the sequence, in the same order.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence object …)
- Description
-
-
object
- any value
-
Returns a new sequence containing all the argument elements, in the same order.
- Definition
-
(sequence-split-at sequence i)
- Description
-
-
sequence
- a sequence instance -
i
- an integer
-
Returns two values, the first containing the first i
elements of the
sequence, and the second containing the remaining elements.
If i
is negative, returns an empty sequence and the original sequence.
If i
is greater than the sequence length, returns the original sequence and an empty sequence.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-take sequence i)
- Description
-
-
sequence
- a sequence instance -
i
- an integer
-
Returns a new sequence containing the first i
elements of the sequence.
If i
is negative, returns the empty sequence. If i
is greater than the
sequence length, returns the whole sequence.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-drop sequence i)
- Description
-
-
sequence
- a sequence instance -
i
- an integer
-
Returns a new sequence containing all but the first i
elements of the
sequence. If i
is negative, returns the whole sequence. If i
is greater
than the sequence length, returns the empty sequence.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-ref sequence i)
- Description
-
-
sequence
- a sequence instance -
i
- a non-negative integer
-
Returns the element at the specified index in the sequence.
- Error
-
If
sequence
is not a sequence instance, ori
is out of range.
- Definition
-
(sequence-set sequence i object)
- Description
-
-
sequence
- a sequence instance -
i
- a non-negative integer -
object
- any value
-
Returns a new sequence with the element at the specified index in the sequence replaced by the given object.
- Error
-
If
sequence
is not a sequence instance, ori
is out of range.
- Definition
-
(sequence-fold proc base sequence)
- Description
-
-
proc
- a combiner procedure taking two arguments (the value of the position in the sequence, and the accumulated value), returning a single value -
base
- the initial accumulator value -
sequence
- a sequence instance
-
Returns the value obtained by iterating the combiner procedure over the sequence in left-to-right order.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-fold-right proc base sequence)
- Description
-
-
proc
- a combiner procedure taking two arguments (the value of the position in the sequence, and the accumulated value), returning a single value -
base
- the initial accumulator value -
sequence
- a sequence instance
-
Returns the value obtained by iterating the combiner procedure over the sequence in right-to-left order.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-reverse sequence)
- Description
-
-
sequence
- a sequence instance
-
Returns a new sequence containing all the elements of the sequence in reverse order.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-map proc sequence)
- Description
-
-
proc
- a procedure mapping an element to another value -
sequence
- a sequence instance
-
Returns a new sequence obtained by applying the procedure to each element of the sequence in turn.
- Error
-
If
sequence
is not a sequence instance.
- Definition
-
(sequence-filter proc sequence)
- Description
-
-
proc
- a predicate mapping an element to a boolean -
sequence
- a sequence instance
-
Returns a new sequence containing all the elements for which the predicate is true.
- Error
-
If
sequence
is not a sequence instance.
(pfds set)
- Definition
-
(set? object)
- Description
-
-
object
- any value
-
Returns #t
if object is a set instance.
- Definition
-
(make-set element<?)
- Description
-
-
element<?
- an ordering procedure
-
Returns a new empty set ordered by the element<?
procedure.
- Definition
-
(set-member? set element)
- Description
-
-
set
- a set instance -
element
- any value
-
Returns #t
if the element is in the set.
- Error
-
If
set
is not a set instance.
- Definition
-
(set-insert set element)
- Description
-
-
set
- a set instance -
element
- any value
-
Returns a new set created by inserting element into the given set.
- Error
-
If
set
is not a set instance.
- Definition
-
(set-remove set element)
- Description
-
-
set
- a set instance -
element
- any value
-
Returns a new set created by removing element from the given set.
- Error
-
If
set
is not a set instance.
- Definition
-
(set-size set)
- Description
-
-
set
- a set instance
-
Returns the number of elements in the set.
- Error
-
If
set
is not a set instance.
- Definition
-
(set<? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if set-1
is a proper subset of set-2
, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set⇐? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if set-1
is a subset of set-2
, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set=? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if every element of set-1
is in set-2
and vice-versa, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set>=? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if set-2
is a subset of set-1
, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set>? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if set-2
is a proper subset of set-1
, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(subset? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if set-1
is a subset of set-2
, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(proper-subset? set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns #t
if set-1
is a proper subset of set-2
, #f
otherwise.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set-map proc set)
- Description
-
-
proc
- mapping procedure from value to value -
set
- a set instance
-
Returns a new set created by applying the given proc to each element of the set.
- Error
-
If
set
is not a set instance.
- Definition
-
(set-fold proc base set)
- Description
-
-
proc
- combiner procedure, taking an element from the set and accumulator value, and returning a new accumulated value -
base
- initial value -
set
- a set instance
-
Returns the value obtained by iterating the procedure over each element of the set and an accumulator value.
- Error
-
If
set
is not a set instance.
- Definition
-
(list→set list-items element<?)
- Description
-
-
list-items
- list of values -
element<?
- an ordering procedure
-
Returns a set containing all the elements of the list, ordered by element<?
.
- Definition
-
(set→list set)
- Description
-
-
set
- a set instance
-
Returns all the elements of the set as a list.
- Error
-
If
set
is not a set instance.
- Definition
-
(set-union set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns the set containing the union of the two given sets, i.e. all the
elements in set-1
and set-2
.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set-intersection set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns the set containing the intersection of the two given sets, i.e. all the
elements that are in both set-1
and set-2
.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set-difference set-1 set-2)
- Description
-
-
set-1
- a set instance -
set-2
- a second set instance
-
Returns the set containing the difference of the two given sets, i.e. all the
elements in set-1
that are not in set-2
.
- Error
-
If
set-1
orset-2
is not a set instance.
- Definition
-
(set-ordering-procedure set)
- Description
-
-
set
- a set instance
-
Returns the ordering procedure used internally by the set.
- Error
-
If
set
is not a set instance.