lib/qlang/api/matrix_api.rb in qlang-0.0.27180000 vs lib/qlang/api/matrix_api.rb in qlang-0.0.27182000
- old
+ new
@@ -2,15 +2,17 @@
module Api
module MatrixApi
def execute(rows)
row_count = rows.count
column_count = rows.first.count
- case $type
- when :R
+ case $meta_info.lang
+ when :r
"matrix(#{VectorApi.execute(rows.flatten)}, #{row_count}, #{column_count}, byrow = TRUE)"
- when :Ruby
+ when :ruby
arys_str = rows.map { |row| "[#{row.join(', ')}]" }.join(', ')
"Matrix[#{arys_str}]"
+ else
+ fail "Matrix is not implemented for #{LANGS_HASH[$meta_info.lang.to_s]}"
end
end
module_function :execute
end
end