(util treemap) - Treemap

Library (util treemap)

This library provides treemap data structure and operations.

This section uses the following name convention;

tm - treemap

Predicate and constructurs

Returns #t when given object is a treemap.

compare must be a procedure which accepts 2 arguments and returns integer indicating the order of given 2 arguments.

Creates red black treemap.

Basic operations

Returns a value associated with key in tm. If it doesn't exist, then fallback will be returned.

Returns #t if there is an entry associated to the given key, otherwise #f.

Associate the value to key in tm and returns unspecified value.

proc must be a procedure accepts one argument.

Updates the entry value associated to key with the returned value of proc. If the entry doesn't exist then default will be passed to the proc.

Deletes entry of key in tm and returns unspecified value.

Removes all entries and returns unspecified value.

Returns the copy of given tm.

Returns the number of entry in the given tm.

Conversions

Returns an alist of key and value in tm.

alist must be an alist. compare must be a procedure which accepts 2 arguments.

Converts alist to a treemap. The car part of an element of _alist_is a key, then cdr part of an element of alist is a value.

Keys and values

Returns a vector or a list of keys in tm, respectively.

Returns a vector or a list of entry values in tm, respectively.

Returns vectors or lists of entry key and values in tm, respectively. This procedure returns 2 values.

Iterations

kons must be a procedure which accepts 3 arguments.

Iterates all keys and values in the given tm and passes them and the result of kons to kons respectively. The first iteration of the third argument is knil. The procedure returns the result of all iterations.

Analogous to fold.

proc must be a procedure which accepts 2 arguments.

Iterates all keys and values in the given tm and passes them to proc respectively.

The treemap-for-each returns unspecified value. The treemap-map returns a list of the proc result.

These procedures are analogous to for-each and map respectively.