Next: , Previous: , Up: fingertrees   [Contents][Index]


7.2 Core constructors and predicates

Function: make-fingertree IDENTITY COMBINE measure

Return a new fingertree, parameterised by the given monoid.

Function: fingertree-measure FINGERTREE

Return the measure of FINGERTREE, as defined by FINGERTREE’s monoid.

Function: fingertree? OBJ

Return #t if OBJ is a fingertree, #f otherwise.

Function: fingertree-empty? FINGERTREE

Return #t if there are no items in the fingertree, #f otherwise.

Function: fingertree-cons item FINGERTREE

Return the new fingertree created by adding the item to the front of FINGERTREE.

Function: fingertree-snoc FINGERTREE item

Return the new fingertree created by adding item to the end of FINGERTREE.

Function: fingertree-uncons FINGERTREE

Returns 2 values: the item at the front of FINGERTREE, and a new fingertree containing all but the front element. If FINGERTREE is empty: a pfds-fingertree-empty-condition condition is raised.

Function: fingertree-unsnoc FINGERTREE

Return 2 values: a new fingertree containing all but the rear element of FINGERTREE, and the rear element itself. If FINGERTREE is empty: a pfds-fingertree-empty-condition condition is raised.

Function: fingertree-append fingertree1 fingertree2

Return a new fingertree which contains all of the elements of fingertree1, followed by all the elements of fingertree2. The arguments are assumed to be parameterised by the same monoid.

Function: list->fingertree list-of-items identity append convert

Return a fingertree containing all of the elements of the list argument, in the same order.

Function: fingertree->list FINGERTREE

Return a list of all the items in FINGERTREE, in the order they would be unconsed.

Function: fingertree-split predicate FINGERTREE

Return 2 values: a new finger tree representing the largest prefix of FINGERTREE for which applying the predicate to it’s accumulated measure returns #f; is a new fingertree containing all those elements not in the first fingertree.

predicate must be a function accepting a single argument and returning a boolean.

Function: fingertree-split3 predicate FINGERTREE

Similar to fingertree-split, however, instead of returning the remainder as the second argument, return the head of the remainder as second value, and tail of the remainder as third value.

Function: fingertree-fold COMBINER ACCUM-BASE FINGERTREE

Return the value obtained by iterating the COMBINER procedure over FINGERTREE in left–to–right order. This procedure takes two arguments: the current value from FINGERTREE, and an accumulator; it’s return value is used as accumulator for the next iteration. The initial value for the accumulator is given by the base argument.

Function: fingertree-fold-right COMBINER FINGERTREE

Similar to fingertree-fold, but iterate in right–to–left order.

Function: fingertree-reverse FINGERTREE

Return a new fingertree in which the items are in the opposite order from FINGERTREE.


Next: , Previous: , Up: fingertrees   [Contents][Index]

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