class Dhall::Builtins::Natural_subtract

Protected Instance Methods

uncurried_call(x, y) click to toggle source
# File lib/dhall/builtins.rb, line 104
def uncurried_call(x, y)
        return y if zero?(x) || zero?(y)

        return Dhall::Natural.new(value: 0) if x == y

        unless x.is_a?(Dhall::Natural) && y.is_a?(Dhall::Natural)
                return unfill(x, y)
        end

        Dhall::Natural.new(value: [y.to_i - x.to_i, 0].max)
end
zero?(x) click to toggle source
# File lib/dhall/builtins.rb, line 116
def zero?(x)
        Natural_isZero.new.call(x) === true
end