Re: make-dictionary and DTDs; additional functions
Wolfgang Corcoran-Mathe 18 Aug 2021 16:12 UTC
On 2021-08-13 12:36 +0200, Marc Nieper-Wißkirchen wrote:
> Am Fr., 6. Aug. 2021 um 04:13 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
> > Here's the design I'm going with for make-dictionary:
> >
> > make-dictionary accepts two arguments, a DTD and a comparator; however, if
> > the dictionary type does not accept a comparator, pass #f. The function
> > dict-comparator will return #f if the various functions are fixed.
> >
>
> I still don't understand why you want a comparator here. As some
> dictionary types do not accept a comparator, it is a strong hint that it is
> the wrong abstraction to pass a comparator to make-dictionary.
>
> Instead, provide something like (dtd-copy dtd1 dtd2 dict1 dict2).
What is meant by "does not accept a comparator" here? Is it not the
case that *all* dictionary types make use of an equality predicate
(defined on keys) at the very least?
Since a notion of key equality (sort of a phantom comparator, since
the equality predicate, etc. is not accessible) is provided by the
DTD object, it's not clear to me what the comparator argument of
make-dictionary is used for. Is it to allow the dictionary type to be
parameterized over a comparable type of values?
The exact relationship of dictionary types and comparators here is
a little unclear to me.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"Hundreds will be voluble in admiration, for one who will be
silent in delight." --John Ruskin