Brian Goetz brian.goetz at
Sat Sep 22 11:00:43 PDT 2012

> I like these rules.  The default-bearing version(s) can be emulated with
> the Option version with an additional Option2Default transform stage, so
> I would like to avoid the default-bearing version(s) if we can get away
> with it.

Right.  We can factor out the default-injection by having an ifEmpty op:


Not a big deal currently as we have relatively few Option-bearing ops, 
but probably better to factor these out rather than ad-hoc fusing. 
Similarly, we can have a filterNulls() op if users want the first 
non-null value:


(For stream sources where we *know* there are no nulls, such as 
TreeSet.keys(), the cost of the filterNulls() is O(1) since it can be 
optimized out of existence when we build the chain.)

More information about the lambda-libs-spec-observers mailing list