Class: Plus

Inherits:
Op
  • Object
show all
Defined in:
lib/jop.rb

Constant Summary collapse

REP =
'+'

Instance Method Summary collapse

Methods inherited from Op

#apply_monad_deep, #integer_args, #numeric_literal?, #to_numeric

Instance Method Details

#run(ary, interpreter) ⇒ Object



157
158
159
160
161
# File 'lib/jop.rb', line 157

def run ary, interpreter
  args = integer_args(interpreter)
  interpreter.advance(args.length)
  args.empty? ? ary : ary.zip(args).map {|x,y| x + y }
end