[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ongoing work, maps and dictionaries

This page is part of the web mail archives of SRFI 44 from before July 7th, 2015. The new archives for SRFI 44 contain all messages, not just those from before July 7th, 2015.



scgmille@xxxxxxxxxxxxxxxxxx wrote:
> In discussions just before and during the Scheme Workshop, Anton
> raised the idea of separating the m:1 and m:n (single vs multivalue)
> dictionaries into two types.  This makes a tremendous amount of sense.

Good idea. While it isn't strictly necessary, many existing collection
libraries do it this way.

> The current draft has this change, with a Map type for
> single-key->single-value collections, and a Dictionary subtype for
> single-key->multiple-value collections.

Not too happy about the specific name choices, though. Set theory calls
a MxN mapping a "relationship" or just "mapping." Mx1 mappings are
usually called "partial functions" or "functions" (depending on whether
the mapping covers the entire domain). In other words, "mapping" is the
more general name.

Unfortunately, "relationship" and "function" are probably confusing for
programmers, and they may imply semantics that the collections do not
have. For another example of prior art in this area, see C++, which
calls them "map" and "multimap."

> While correcting this, I made an attempt to rename the bulk operators
> to be more consistent and less confusing.  The current thought is:
> 
> *-{operator} - ordinary single instance call
> *-{operator}-all - multiple value call 
> *-{operator}-from - call requiring another collection as a source
> *-{operator}-all-from - multivalue version of above.

Good idea.

> You can view the work-in-progress at sgmiller.org/code/srfi-44.html.
> The concrete collection specification still needs to be updated to
> match completely.

I don't have much time for a thorough review at this time, but the above
mentioned changes sound good.
-- 
Bradd W. Szonye
http://www.szonye.com/bradd