3 ms·
So in Ruby, `map` and `select` are eager-by-default, but you can just write `lazy.map().select()` to make the whole chain lazy? That's really nice - much better
by pansa2 2y ago
So in Ruby, `map` and `select` are eager-by-default, but you can just write `lazy.map().select()` to make the whole chain lazy? That's really nice - much better than Python 2, which was also eager-by-default and you had to change every function call to make it lazy (`map` => `imap`, `filter` => `ifilter`).
Python 3 changed to being lazy-by-default. I assume that improves CPU/memory usage, but in some cases it does have less predictable behaviour. I can see why Ruby, with its goal of "developer happiness", would choose to retain the predictable behaviour of eager-by-default.
- saagarjha 2y agoSwift does this too, with almost the same syntax. IMO it's the right choice.