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

Re: A few typos in the latest SRFI-44 drafts

On Mon, Aug 18, 2003 at 11:52:09AM -0700, oleg@xxxxxxxxx wrote:
> Hello!
> >        procedure: *-get-left * [default]=> value
> >            Returns an unspecified value from the given
> >            collection. If the collection is empty, default is 
> >            returned if present, otherwise #f is returned.
> Hmm, "Returns an unspecified value". I know what you mean. However,
> that word, 'unspecified', immediately reminded me a R5RS phrase "the
> return value of the set! expression is unspecified". It isn't the same
> unspecified, is it? Perhaps a phrase "Returns a value from the given
> collection. For a general collection, it is unspecified which of its
> values is returned. Ordered collection specify that." might be more
> suitable.

I agree.

> >            procedure: dict? value => boolean
> >                 Returns a non-false value if the provided value is a flexible
> >                 sequence
> You probably meant "dictionary" rather than a "flexible sequence".

> 	I also have a half-hearted suggestion about dictionaries.
> collection-fold-left on dictionaries iterates on
> values. collection-fold-keys-left iterates on keys. Somehow there
> isn't anything that iterates on keys and the corresponding values. At
> the first blush, keys+values seem to be a bit more useful than merely
> values. Furthermore, it's usually quite easy for a collection to
> obtain the corresponding key when iterating over values. OTH,
> iterating on keys and using dict-get to get the corresponding value is
> usually far less efficient. I thought that perhaps
> collection-fold-left can pass to its fold-function not merely a value
> but a pair (key . value). This is just a remark.

It could, but that might impede passing dictionaries as ordinary 
collections to routines.  Take for example a program which stores its 
data in a dictionary in order to provide quick access using a key to a 
single value, but wants to pass that dictionary as a blob of values to 
some function that is written to accept any collection.

Passing keys+values to the proc in a collection-fold-keys-* should be 
fine however.  

CCing to the discussion list.


Attachment: pgp6YxM52eR69.pgp
Description: PGP signature