New aggregation selector

Brian Rice water at tunes.org
Tue Oct 19 09:20:27 PDT 2004


There's a new collection aggregation method in CVS called project: to 
mirror the growing collection of 
do:/select:/reject:/collect:/infect:/inject:into:. mapping.slate and 
stream.slate contain the relevant (and short) code.

project: is similar to collect:, but goes a step further by answering a 
Mapping (usually a Dictionary) from the original collection's elements 
to the results of applying the block to each. As all of the other 
collection protocols (except for infect: which just modifies dictionary 
values in-place), this can also be used on any ReadStream and returning 
another such stream that the elements (in this case Associations) can 
be read from one-by-one. (And for those who aren't familiar, a 
ReadStream type is available from any collection as a "reader".)

This was developed for some new code, but I'd be interested if people 
come up with interesting use-cases, perhaps even in existing code.

--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1058 bytes
Desc: not available
Url : /archives/slate/attachments/20041019/f5f37d07/attachment.bin


More information about the Slate mailing list