> On 14 Nov 2017, at 16:49 , Denis Kudriashov <dionisi...@gmail.com> wrote:
> 
> 
> squares := (1 to: 1000) ~> #squared map ~> 1000 take ~> Set.
> fileIn readStream ~> #isSeparator filter ~> fileOut writeStream.

I’ve actually done something very similar for collections in Grace, except that 
I use >> as the operator symbol.

My original idea was when implementing Grace’s filter and map methods, which 
correspond to select: and collect: in Smalltalk.  I wanted to avoid species and 
it’s spawn.  So instead I made filter and map produce streams of values, which 
can then be >>’d into the container of the programmer’s choice.

In Grace we can write now

        (1..100).filter { each → each.isEven } >> set.empty

I’ve been vacillating over whether the final sink should be a collection 
factory (like Set) or a collection instance (which might be empty or might 
already contain some elements).   We could also make >> accept a block as its 
argument, and eliminate either the map or filter word, but not both. 

        Andrew


Reply via email to