A brief description of every exported name in every library of the pfds namespace of r7rs-libs.

(pfds bounded-balance-tree)

[procedure] make-bbtree
Definition

(make-bbtree key<?)

Description
  • key<? - ordering procedure for keys

Returns an empty bounded balance tree.

Error

If key<? is not a procedure.

[procedure] bbtree?
Definition

(bbtree? object)

Description
  • object - any value

Returns #t if the object is a bounded balance tree instance.

[procedure] bbtree-size
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.

[procedure] bbtree-ref
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, or key is not in tree and no default provided.

[procedure] bbtree-set
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.

[procedure] bbtree-update
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.

[procedure] bbtree-delete
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.

[procedure] bbtree-contains?
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.

[procedure] bbtree-ordering-procedure
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.

[procedure] bbtree-traverse
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.

[procedure] bbtree-fold
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.

[procedure] bbtree-fold-right
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.

[procedure] bbtree-map
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.

[procedure] bbtree→alist
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.

[procedure] alist→bbtree
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.

[procedure] bbtree-keys
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.

[procedure] bbtree-union
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 or bbtree-2 is not a bounded balance tree instance.

[procedure] bbtree-difference
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 or bbtree-2 is not a bounded balance tree instance.

[procedure] bbtree-intersection
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 or bbtree-2 is not a bounded balance tree instance.

[procedure] bbtree-index
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.

[procedure] bbtree-ref/index
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, or index is not valid.

(pfds deque)

[procedure] make-deque
Definition

(make-deque)

Description

Returns a deque containing no items.

[procedure] deque?
Definition

(deque? object)

Description
  • object - any value

Returns #t if object is a deque.

[procedure] deque-length
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.

[procedure] deque-empty?
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.

[procedure] enqueue-front
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.

[procedure] enqueue-rear
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.

[procedure] dequeue-front
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.

[procedure] dequeue-rear
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.

[procedure] deque→list
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.

[procedure] list→deque
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)

[procedure] dlist
Definition

(dlist element …​)

Description
  • element - any value

Returns a difference list containing all the given elements.

[procedure] dlist?
Definition

(dlist? object)

Description
  • object - any value

Returns #t if object is a difference list.

[procedure] dlist-cons
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.

[procedure] dlist-snoc
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.

[procedure] dlist-append
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 or dlist-2 is not a difference list instance.

[procedure] dlist→list
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.

[procedure] list→dlist
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)

[procedure] make-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.

[procedure] fector
Definition

(fector element …​)

Description
  • element - any value

Returns a fector whose initial values are the given elements.

[procedure] fector?
Definition

(fector? object)

Description
  • object - any value

Returns #t if object is a fector instance.

[procedure] fector-length
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.

[procedure] build-fector
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.

[procedure] fector-ref
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 if index is not valid.

[procedure] fector-set
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 if index is not valid.

[procedure] list→fector
Definition

(list→fector list-items)

Description
  • list-items - list of values

Returns a fector initialised with the contents of the given list.

[procedure] fector→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)

[procedure] fingertree?
Definition

(fingertree? object)

Description
  • object - any value

Returns #t if object is a fingertree.

[procedure] fingertree-empty?
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.

[procedure] make-fingertree
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.

[procedure] fingertree-cons
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.

[procedure] fingertree-snoc
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.

[procedure] fingertree-uncons
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.

[procedure] fingertree-unsnoc
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.

[procedure] fingertree-append
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 or fingertree-2 is not a fingertree instance.

[procedure] list→fingertree
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.

[procedure] fingertree→list
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.

[procedure] fingertree-measure
Definition

(fingertree-measure fingertree)

Description
  • fingertree - a fingertree instance

Returns the measure of the given fingertree.

Error

If fingertree is not a fingertree instance.

[procedure] fingertree-split
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.

[procedure] fingertree-split3
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.

[procedure] fingertree-fold
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.

[procedure] fingertree-fold-right
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.

[procedure] fingertree-reverse
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)

[procedure] make-hamt
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.

[procedure] hamt?
Definition

(hamt? object)

Description
  • object - any value

Returns #t if the object is a hamt instance.

[procedure] hamt-size
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.

[procedure] hamt-ref
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 a key is used with no value or default.

[procedure] hamt-set
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.

[procedure] hamt-update
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.

[procedure] hamt-delete
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.

[procedure] hamt-contains?
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.

[procedure] hamt-equivalence-predicate
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.

[procedure] hamt-hash-function
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.

[procedure] hamt-fold
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.

[procedure] hamt-map
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.

[procedure] hamt→alist
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.

[procedure] alist→hamt
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)

[procedure] make-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.

[procedure] heap
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.

[procedure] heap?
Definition

(heap? object)

Description
  • object - any value

Returns #t if the object is a heap instance.

[procedure] heap-size
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.

[procedure] heap-empty?
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.

[procedure] heap-min
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.

[procedure] heap-delete-min
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.

[procedure] heap-insert
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.

[procedure] heap-pop
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.

[procedure] heap→list
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.

[procedure] list→heap
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.

[procedure] heap-merge
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 or heap-2 is not a heap instance.

[procedure] heap-sort
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.

[procedure] heap-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)

[procedure] make-psq
Definition

(make-psq key<? priority<?)

Description
  • key<? - ordering procedure for keys

  • priority<? - ordering procedure for priorities

Returns an empty priority search queue.

[procedure] psq?
Definition

(psq? object)

Description
  • object - any value

Returns #t if the object is a priority search queue instance.

[procedure] psq-empty?
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.

[procedure] psq-size
Definition

(psq-size psq)

Description
  • psq - a priority search queue instance

[procedure] psq-ref
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 if key is not in the priority search queue.

[procedure] psq-set
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.

[procedure] psq-update
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.

[procedure] psq-delete
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.

[procedure] psq-contains?
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.

[procedure] psq-min
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, or psq is empty.

[procedure] psq-delete-min
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, or psq is empty.

[procedure] psq-pop
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, or psq is empty.

[procedure] psq-at-most
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.

[procedure] psq-at-most-range
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)

[procedure] make-queue
Definition

(make-queue)

Description

Returns a queue containing no items.

[procedure] queue?
Definition

(queue? object)

Description
  • object - any value

Returns #t if object is a queue.

[procedure] queue-length
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.

[procedure] queue-empty?
Definition

(queue-empty? queue)

Description
  • queue - a queue instance

Returns #t if the queue is empty.

Error

If queue is not a queue instance.

[procedure] enqueue
Definition

(enqueue queue item)

Description
  • queue - a queue instance

  • item - any value

Returns a new queue with the enqueued item at the end.

[procedure] dequeue
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.

[procedure] list→queue
Definition

(list→queue list-items)

Description
  • list-items - list of values

Returns a queue containing all of the elements in the list in order.

[procedure] queue→list
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)

[procedure] make-sequence
Definition

(make-sequence)

Description

Returns a new empty sequence.

[procedure] sequence?
Definition

(sequence? object)

Description
  • object - any value

Returns #t if the object is a sequence.

[procedure] sequence-empty?
Definition

(sequence-empty? sequence)

Description
  • sequence - a sequence instance

Returns #t if the sequence contains no elements.

Error

If sequence is not a sequence.

[procedure] sequence-size
Definition

(sequence-size sequence)

Description
  • sequence - a sequence instance

Returns the number of elements in the sequence.

Error

If sequence is not a sequence.

[procedure] sequence-cons
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.

[procedure] sequence-uncons
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.

[procedure] sequence-snoc
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.

[procedure] sequence-unsnoc
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.

[procedure] sequence-append
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 or seq-2 is not a sequence.

[procedure] list→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.

[procedure] sequence→list
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.

[procedure] sequence
Definition

(sequence object …​)

Description
  • object - any value

Returns a new sequence containing all the argument elements, in the same order.

[procedure] sequence-split-at
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.

[procedure] sequence-take
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.

[procedure] sequence-drop
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.

[procedure] sequence-ref
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, or i is out of range.

[procedure] sequence-set
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, or i is out of range.

[procedure] sequence-fold
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.

[procedure] sequence-fold-right
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.

[procedure] sequence-reverse
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.

[procedure] sequence-map
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.

[procedure] sequence-filter
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)

[procedure] set?
Definition

(set? object)

Description
  • object - any value

Returns #t if object is a set instance.

[procedure] make-set
Definition

(make-set element<?)

Description
  • element<? - an ordering procedure

Returns a new empty set ordered by the element<? procedure.

[procedure] set-member?
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.

[procedure] set-insert
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.

[procedure] set-remove
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.

[procedure] set-size
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.

[procedure] set<?
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 or set-2 is not a set instance.

[procedure] set⇐?
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 or set-2 is not a set instance.

[procedure] set=?
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 or set-2 is not a set instance.

[procedure] set>=?
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 or set-2 is not a set instance.

[procedure] set>?
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 or set-2 is not a set instance.

[procedure] subset?
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 or set-2 is not a set instance.

[procedure] proper-subset?
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 or set-2 is not a set instance.

[procedure] set-map
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.

[procedure] set-fold
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.

[procedure] list→set
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<?.

[procedure] set→list
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.

[procedure] set-union
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 or set-2 is not a set instance.

[procedure] set-intersection
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 or set-2 is not a set instance.

[procedure] set-difference
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 or set-2 is not a set instance.

[procedure] set-ordering-procedure
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.