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

Re: Traits, 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:
> Actually, I'm vehemently against collection-fold ever looping over a
> circular but finite collection.  Half of the advantage of collection
> fold is that it allows you to pass functions unaware of the properties
> of the underlying collection and let the implementation handle
> retrieving all the requisite values.
> 
> Potentially or actually infinite collections are another matter ....

So it depends on the "true nature" of the collection, then. Examples:

A modulo-sequence lets you use wrap-around indexes (like -1 or bignum)
but it's really a finite sequence, so *-size returns a true value, and
collection-fold halts.

An infinite-sequence really is infinite, even if its internal
representation isn't, so *-size returns #f, and collection-fold does not
halt.

Based on this, I say: Tighten up the definitions of *-size and fold to
make this more obvious, but otherwise no changes. There's no need for
finite-collection?, because it's essentially equivalent to *-size under
this interpretation.
-- 
Bradd W. Szonye
http://www.szonye.com/bradd