3 ms·
The third seems to be shorthand for map and reduce (or only reduce). In Ruby, you could express the same with `[2,4,6].reduce(true) {|even,num| even & num.even
by bhaak 11y ago
The third seems to be shorthand for map and reduce (or only reduce).
In Ruby, you could express the same with `[2,4,6].reduce(true) {|even,num| even & num.even? }` or more clearer IMO `[2,4,6].map(&:even?).reduce(&:&)`.