lib/qlang/iq.rb in qlang-0.0.14142 vs lib/qlang/iq.rb in qlang-0.0.141421
- old
+ new
@@ -1,17 +1,25 @@
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)
- case ruby_obj
- when Matrix, Vector
+ output = case ruby_obj
+ when Matrix, Vector, Dydx::Algebra::Formula
ruby_obj.to_q
when Float::INFINITY
'oo'
when - Float::INFINITY
'-oo'
else
- ruby_obj
+ str = ruby_obj.to_s
+ str.equalize!
end
end
module_function :execute
end
end