Class: Integer

Inherits:
Object show all
Defined in:
lib/lab419/core/integer/operators.rb,
lib/lab419/core/integer/instance_methods.rb

Constant Summary collapse

Summer =
-> *args do
  args.reduce{ |a,b| a + b }
end
Differ =
-> a, b do
  a - b
end
Multiplier =
-> *args do
  args.reduce{ |a,b| a * b }
end
Divisor =
-> a, b do
  a / b
end
Modulator =
-> a, b do
  a % b
end

Class Method Summary collapse

Class Method Details

.diffObject Also known as: -



20
# File 'lib/lab419/core/integer/operators.rb', line 20

def diff; Differ end

.divObject Also known as: /



34
# File 'lib/lab419/core/integer/operators.rb', line 34

def div; Divisor end

.modObject Also known as: %



41
# File 'lib/lab419/core/integer/operators.rb', line 41

def mod; Modulator end

.predObject



3
4
5
# File 'lib/lab419/core/integer/operators.rb', line 3

def pred
  lambda{ |a| a.pred }
end

.prodObject Also known as: *



27
# File 'lib/lab419/core/integer/operators.rb', line 27

def prod; Multiplier end

.succObject



6
7
8
# File 'lib/lab419/core/integer/operators.rb', line 6

def succ
  lambda{ |a| a.succ }
end

.sumObject Also known as: +



13
# File 'lib/lab419/core/integer/operators.rb', line 13

def sum; Summer end