Remove old ldict implementation.

This commit is contained in:
Dominik Pantůček 2023-07-07 12:26:37 +02:00
parent b7aa850b94
commit 1c0e76b022
2 changed files with 0 additions and 393 deletions

View file

@ -8,123 +8,6 @@ well.
The modules are listed in alphabetical order.
### Dictionary
(import util-dict-list)
This module implements a simple key/value dictionary using lists as
backend. All operations are O(n) with respect to time.
(make-ldict [equality?/pairs [pairs]])
* ```equality?/pairs``` - procedure or list of pairs
* ```pairs``` - list of pairs
Creates a new ldict with configurable equality procedure, optionally
populating it with initial data.
If only one argument is given, the procedure checks whether it is a
list of equality procedure and acts accordingly.
(ldict? v)
* ```v``` - any value
Returns ```#t``` if given value is a ldict.
(ldict-empty? ld)
* ```ld``` - a ldict instance
Returns ```#t``` if given dictionary contains no keys.
(ldict-contains? ld k)
* ```ld``` - a ldict instance
* ```k``` - a key compatible with given ldict
Returns ```#t``` if given ```ld``` contains given key ```k```.
(ldict-ref ld k [default])
* ```ld``` - a ldict instance
* ```k``` - a compatible key
* ```default``` - optional fallback value
Retrieves the value associated with given key in given dictionary. If
the dictionary does not contain it and no default is given, an
exception is raised. Otherwise the default value is returned in case
of missing key.
(ldict-remove ld k)
* ```ld``` - a ldict instance
* ```k``` - a compatible key
Returns a new dictionary with the record under given key removed. If
the dictionary does not contain the key ```k```, an error is raised.
(ldict-set ld k v)
* ```ld``` - a ldict instance
* ```k``` - a compatible key
* ```v``` - a value to insert
Sets existing key ```k``` to the new value ```v``` or inserts it if it
is not already present in the dictionary ```ld```.
(ldict-keys ld)
* ```ld``` - a ldict instance
Returns the list of keys stored in given dictionary.
(ldict-map proc ld)
* ```proc``` - procedure accepting 1, 2 or 3 arguments
* ```ld``` - a ldict instance
Returns a new dictionary of the same type with all values processed by
given procedure.
If it accepts one argument, only the value is passed to it. If it
accepts two values, the key and the value is passed to it. And lastly
if it accepts three arguments, the key, value and numeric index
(starting from 0) are passed to it.
In all cases the value the procedure returns is taken as the new value
for given key.
(ldict-filter pred? ld)
* ```pred?``` - predicate procedure
* ```ld``` -a ldict instance
Returns a new dictionary containing only key/value pairs matching the
given predicate. The procedure ```pred?``` must accept two arguments -
the key and the value.
(ldict-reduce init proc ld)
* ```init``` - initial accumulator value
* ```proc``` - accumulating procedure
* ```ld``` - a ldict instance
Performs a reduce operation on the pairs of given dictionary using
```init``` as initial accumulator. The accumulating procedure must
accept three arguments: the value accumulated so far, the key and the
value.
(ldict-equal? d1 d2 [equality?])
* ```d1``` - a ldict instance
* ```d2``` - a ldict instance
* ```equality?``` - optional equality? predicate for values
Returns ```#t``` if both dictionaries contain the same keys and their
values are equal according to the provided ```equality?``` predicate
which defaults to ```equal?```.
### Set (List)
(import util-set-list)