Re: make-dictionary and DTDs; additional functions
Wolfgang Corcoran-Mathe 18 Aug 2021 17:37 UTC
On 2021-08-18 18:30 +0200, Marc Nieper-Wißkirchen wrote:
> Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz> schrieb am Mi., 18. Aug. 2021,
> 18:12:
>
> > 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?
> >
>
> Abstractly, yes, but not every dictionary type does expose it or allow an
> arbitrary equality predicate.
>
> What I meant with "does not accept" is that the constructors of the general
> dictionary type do not take a comparator argument.
Thanks. I agree that this is clearly not something that every
dictionary type has a use for, and its appearance as a parameter of
make-dictionary is unbeautiful. Or, perhaps, it is simply too
specific. Are there other parameters that make sense only for
specific dictionary types? If so, maybe there should be a more
general way to pass these when constructing a dictionary.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"I have regarded it as the highest goal of programming language design
to enable good ideas to be elegantly expressed." --C.A.R. Hoare