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

Re: Traits, dictionaries



> 
> > This sort of thing is also handy for collections like circular lists,
> > wrap-around vectors, and similar collections.
> Maybe, maybe not.  The semantics of collection-fold are such that
> an enumeration over a collection should enumerate once over all the 
> values in the collection unless halted by the folding function.
> 
> Circular lists and simliar collections can be created using the 
> negative index trick hinted at by the SRFI, but I'm unsure whether 
> folds should proceed indefinitely over finite collections.  Other 
> thoughts?

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.  Its 
reasonable to pass a function to fold which won't terminate an infinite 
stream, for example, passing a function to display characters from a 
TCP/IP stream.  

	Scott

Attachment: pgpGmIaVxi94x.pgp
Description: PGP signature