Sha256: dfa102d61c3c4734fbfe9d91ea4f0e5cde21c1c5317045ebd9e06c7c71efe3f4

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

module Qlang
  module Iq
    class Dydx::Algebra::Formula
      # FIX:
      def to_q
        str = to_s.gsub(/\*\*/, '^').rm(' * ')
        str.equalize!
      end
    end
    def execute(code)
      ruby_obj = eval Q.to_ruby.compile(code)
      output = case ruby_obj
      when Matrix, Vector, Dydx::Algebra::Formula
        ruby_obj.to_q
      when Float::INFINITY
        'oo'
      when - Float::INFINITY
        '-oo'
      else
        str = ruby_obj.to_s
        str.equalize!
      end
    end
    module_function :execute
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qlang-0.0.14142135 lib/qlang/iq.rb
qlang-0.0.1414213 lib/qlang/iq.rb
qlang-0.0.141421 lib/qlang/iq.rb