Re: LAST CALL for SRFI-113, Sets and bags
John Cowan 18 Aug 2014 22:38 UTC
Kevin Wortman scripsit:
> Actually any Scheme object _except comparators_, right?
No, they can contain comparators if you use default-comparator.
Using the sample implementation of default-comparator, performance
will suck, because all comparators will hash to the same value. But
everything should work, and a better implementation-specific version
of default-comparator will work better.
> May a multi-values object be an element? If so there are some minor picky
> edits, for example "The value that *mapper* returns is added to the set"
> should be "The object that *mapper* returns is added to the set".
Multiple values aren't an object (though they are implemented that way
in some Schemes). Calling (set default-comparator (values 1 2)) doesn't
work reliably.
> "Sets are a standard part of the libraries of many high-level programming
> languages..."
> You might want to cite SRFI 1 list sets here too.
Done.
> "and can be optimized" sounds awkward, consider rewording to "and allows
> for optimization".
Done.
> "hysterical raisins" should be "historical reasons" right?
It's a joke: see <http://www.catb.org/jargon/html/H/hysterical-reasons.html>
> "Implementations must not require the provision of both a comparison
> procedure and a hash function."
> Any reason for this? An implementor might want to use a hybrid hash/tree
> data structure such as a treap.
I think it's a reasonable compromise between implementer freedom and
user obligation. But you could talk me out of this.
> "Note that this differs from the SRFI 1 analogue because it does not return
> a useful value."
> IMO #t and #f qualify as useful; consider rewording to "because it does not
> return an element of the set."
Done.
> I think the arguments to the set-map example are in the wrong order.
Fixed. The example hadn't been updated since the change to comparators.
> As discussed previously, I think it would be friendlier for the
> documentation for set-map to say something like:
>
> "Note that, when *proc* defines a non-1:1 mapping, some of the mapped
> objects may be equivalent according to *comparator,* and in this case
> duplicate elements are omitted as in the set constructor. For example,
>
> (set-map (lambda (x) (quotient x 2)) integer-comparator (set
> integer-comparator 1 2 3 4 5))
> => (set integer-comparator 0 1 2)"
Done.
> Likewise, it would be friendly to add this sentence to the documentation
> for list->set, list->set!, and bag->set :
> "Duplicate elements are omitted as in the set constructor."
Done.
> Kevin Wortman
Thanks for the extensive review. The new version will be pushed to
ccil.org shortly.
--
John Cowan http://www.ccil.org/~cowan xxxxxx@ccil.org
I must confess that I have very little notion of what [s. 4 of the British
Trade Marks Act, 1938] is intended to convey, and particularly the sentence
of 253 words, as I make them, which constitutes sub-section 1. I doubt if
the entire statute book could be successfully searched for a sentence of
equal length which is of more fuliginous obscurity. --MacKinnon LJ, 1940