Sha256: 06b93d84cbb2faed709e59c2b7b4913ba4617a217e310fb8d0042e81401c85bc

Contents?: true

Size: 519 Bytes

Versions: 3

Compression:

Stored size: 519 Bytes

Contents

# pops the top 2 items of the +:int+ stack;
# pushes a new ValuePoint onto the +:bool+ stack,
# with value +true+ if the second one is strictly less than the top one
#
# *needs:* 2 +:int+
#
# *pushes:* 1 +:bool+
#

class IntLessThanQInstruction < Instruction
  def preconditions?
    needs :int, 2
  end
  def setup
    @arg2 = @context.pop_value(:int)
    @arg1 = @context.pop_value(:int)
  end
  def derive
      @result = ValuePoint.new("bool", @arg1 < @arg2)
  end
  def cleanup
    pushes :bool, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/int/int_less_than_q.rb
nudge-0.2.8 lib/instructions/int/int_less_than_q.rb
nudge-0.2.7 lib/instructions/int/int_less_than_q.rb