Re: SRFI 225: Dictionaries
Dr. Arne Babenhauserheide 19 Jul 2021 19:12 UTC
Hi,
Dictionaries look extremely useful — thank you!
One thing I miss in the specification are non-mutating update-procedures
that are better suited to functional style (without !-suffix).
Complemented by a way to ask whether they are efficient.
But the more I think about it, the more edge-cases I discover.
My initial idea was:
(dict-efficient-immutable-operations? dict)
Returns #t if the dictionary supports immutable update operations with
a cost lower than O(N) in space and time (with N the number of items in
the dictionary).
The problem here is that deletion is almost never efficient, but then
shere are addition-exclusion¹ sets in CRDTs (two grow-only sets, one of
which removes).
¹: not the official name.
A more restricted check might be useful, though: In functional style
(or more explicitly: in let-recursion) the two methods I see most often
used are set! and delete!: Aggregating results one-by-one and processing
data one-by-one.
So maybe the following two checks and the non-mutating operations could
be useful:
(dict-efficient-immutable-set? dict)
(dict-efficient-immutable-delete? dict)
(dict-set dict key1 value1 key2 value2 ...)
(dict-delete dict key1 key2 ...)
Best wishes,
Arne
Arthur A. Gleckler <xxxxxx@speechcode.com> writes:
> Scheme Request for Implementation 225,
> "Dictionaries,"
> by John Cowan (spec) and Arvydas Silanskas (implementation),
> is now available for discussion.
>
> Its draft and an archive of the ongoing discussion are available at
> https://srfi.schemers.org/srfi-225/.
>
> You can join the discussion of the draft by filling out the subscription
> form on that page.
>
> You can contribute a message to the discussion by sending it to
> xxxxxx@srfi.schemers.org.
>
> Here's the abstract:
>
> The procedures of this SRFI allow callers to manipulate an object that maps
> keys to values without the caller needing to know exactly what the type of
> the object is. Such an object is called a *dictionary* in this SRFI.
>
> Regards,
>
>
> SRFI Editor
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken