Can't load iterator.slate
Brian Rice
water at tunes.org
Thu Nov 4 21:04:17 PST 2004
On Nov 4, 2004, at 8:51 PM, Todd Fleming wrote:
> Brian Rice wrote:
>
>> Bonus points (I guess that means a free feature request granted) if
>> someone remembers what infect: does. ;-)
>
> Woohoo! I remember because I saw infect explained while reading
> through the archive over the past couple days. I hope this doesn't
> count as cheating...
>
> container infect [] replaces each element with the result of applying
> that element to the block.
Yep, and it works on sequences and dictionaries. Well, any Mapping (so
tree structures that count as mappings can also use it).
> container infect [| :a | a + 1]. will increment each element,
> assuming of course that the contents are all magnitudes.
Right.
> I am curious about something; why was this named infect? I suspect you
> named it that way so you can write the following: HardDisk infect [|
> :_ | Windows]. ;)
Actually, a certain Travis Griggs who is a Smalltalker came up with it,
or someone he worked with at ParcPlace. It's pretty obviously about
internal mutation, so... well, it makes sense to me. :-) Anyway we have
a ton of such methods ending in -ect: so it helps if they are all
mnemonic. (select: reject: collect: inject:into: project: ...)
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/
More information about the Slate
mailing list