diff options
| author | 2021-04-02 10:58:16 +0200 | |
|---|---|---|
| committer | 2021-04-02 10:58:16 +0200 | |
| commit | 02ba340087bc1ae7f75529257026e608e4fa09c2 (patch) | |
| tree | e9f18239422294f690ba6bb074797da0be29701d | |
| parent | Initial commit (diff) | |
Use ‘wrap’ and not ‘box’, as suggested by jcowan.
| -rw-r--r-- | composing-comparators.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/composing-comparators.md b/composing-comparators.md index 530c8d5..4ade085 100644 --- a/composing-comparators.md +++ b/composing-comparators.md @@ -2,19 +2,19 @@ ## Specification -### `(make-box-comparator type-test unboxer contents-comparator)` (Procedure) +### `(make-wrapper-comparator type-test unwrap contents-comparator)` (Procedure) -Returns a comparator which compares values satisfying the predicate `type-test` by first calling the given `unboxer` procedure on them, then comparing the output of that procedure with the given `contents-comparator.` The hash function of the box comparator returns the same value as the `contents-comparator` run on the unboxed value. +Returns a comparator which compares values satisfying the predicate `type-test` by first calling the given `unwrap` procedure on them, then comparing the output of that procedure with the given `contents-comparator.` The hash function of the wrapper comparator returns the same value as the `contents-comparator` run on the unwrapped value. ### `(make-composed-comparator type-test comparator ...)` (Procedure) Returns a comparator which compares values satisfying the given predicate `type-test` by comparing them with each of the given comparators in turn, left to right, and returning the result of the first non-equal comparison. If all the given comparators consider two values equal, the composed comparator also considers them equal. The hash function of the composed comparator hashes together the results of all the given comparators in an implementation-defined way. -### `(compose-comparator type-test (unboxer comparator) ...)` (Syntax) +### `(compose-comparator type-test (unwrap comparator) ...)` (Syntax) -Expands to a form which returns a comparator which compares values satisfying the given predicate `type-test` by running in turn, left to right, box comparators made out of the given `unboxer` and `comparator`, according to the rules for `make-composed-comparator`. `comparator` may be omitted from each form, in which case the SERFI 128 default comparator is used. +Expands to a form which returns a comparator which compares values satisfying the given predicate `type-test` by running in turn, left to right, wrapper comparators made out of the given `unwrap` and `comparator`, according to the rules for `make-composed-comparator`. `comparator` may be omitted from each form, in which case the SRFI 128 default comparator is used. -This is equivalent to using the procedural forms `make-composed-comparator` and `make-box-comparator` together, but can be slightly more efficient because it only needs to run the given `type-test` predicate once, whereas composing a number of `make-box-comparator`s would run each box comparator’s type test once for each comparator in the composed comparator. +This is equivalent to using the procedural forms `make-composed-comparator` and `make-wrapper-comparator` together, but can be slightly more efficient because it only needs to run the given `type-test` predicate once, whereas composing a number of `make-wrapper-comparator`s would run each wrapper comparator’s type test once for each comparator in the composed comparator. ## Examples |
