On 14 Nov 2017, at 16:49 , Denis Kudriashov <dionisiydk@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