Class: Lispcalc::Functions

Inherits:
Object
  • Object
show all
Defined in:
lib/lispcalc/functions.rb

Instance Method Summary collapse

Constructor Details

#initialize(ctx) ⇒ Functions

Returns a new instance of Functions.



3
4
5
# File 'lib/lispcalc/functions.rb', line 3

def initialize(ctx)
  @ctx = ctx
end

Instance Method Details

#*(*args) ⇒ Object



15
16
17
# File 'lib/lispcalc/functions.rb', line 15

def *(*args)
  arithmetic_op(:*, args)
end

#+(*args) ⇒ Object



7
8
9
# File 'lib/lispcalc/functions.rb', line 7

def +(*args)
  arithmetic_op(:+, args)
end

#-(*args) ⇒ Object



11
12
13
# File 'lib/lispcalc/functions.rb', line 11

def -(*args)
  arithmetic_op(:-, args)
end

#/(*args) ⇒ Object



19
20
21
# File 'lib/lispcalc/functions.rb', line 19

def /(*args)
  arithmetic_op(:/, args)
end

#do(*args) ⇒ Object



23
24
25
# File 'lib/lispcalc/functions.rb', line 23

def do(*args)
  args.last unless args.empty?
end