3 ms·
module Numeric def times(&b) (1..self).each(&b) end end It's really no different than the Scala you'd write for the same thing: implicit cla
by ssmoot 10y ago
module Numeric
def times(&b)
(1..self).each(&b)
end
end
It's really no different than the Scala you'd write for the same thing:
implicit class LongHelpers(l: Long) {
def times(f: => Any) = (1L to l) foreach f
}
10 times println("here's a line!")
To interpret that as a Set operation would make the definition of a Set operation so broad as to be useless IMO.