Sha256: 726d9fb4fa8a42484f4f285e89862ec3c8f9606964d4fa92193261bbd52cb1ce
Contents?: true
Size: 582 Bytes
Versions: 4
Compression:
Stored size: 582 Bytes
Contents
module Numbers def sum ->(a, b) { a + b } end def even remainder_is(2, 0) end def odd remainder_is(2, 1) end def remainder_is(divisor, remainder) ->(dividend) { remainder(dividend, divisor) == remainder } end def remainder(dividend, divisor) dividend % divisor end def range_from(start) Sequence.new(Enumerators::enumerator(increment, start)) end def range(from, to) Sequence.new((from..to).lazy) end def increment ->(number) { number + 1 } end def mod(divisor) ->(number) { number % divisor } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
totally_lazy-0.1.11 | lib/numbers.rb |
totally_lazy-0.1.10 | lib/numbers.rb |
totally_lazy-0.1.9 | lib/numbers.rb |
totally_lazy-0.1.0 | lib/numbers.rb |