3 ms·
Thanks for the links. Some ruby food for thought . . . > x = nil || 5 #behaviorally equivalent to elvis? > [nil,4,3].compact.map(&:to_s)
by klochner 15y ago
Thanks for the links. Some ruby food for thought . . .
> x = nil || 5 #behaviorally equivalent to elvis?
> [nil,4,3].compact.map(&:to_s) #null-ignored scope
- DanielRibeiro 15y agoYou are welcome. The second line is the essential notion of Maybe monad as a restriction of the Sequence monad (Some of x works like [x] and None works like [], using ruby's [] notation for lists).