Method: Array.from_elisp
- Defined in:
- lib/relisp/type_conversion/programming_types.rb
.from_elisp(object) ⇒ Object
Converts either a ‘cons’ or ‘vector’ to a ruby array.
382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/relisp/type_conversion/programming_types.rb', line 382 def self.from_elisp(object) object_variable = object[:slave].get_permanent_variable(object[:variable]) size = object[:slave].elisp_eval( "(length #{object_variable})" ) object_array = new size.times do |i| object_array << object[:slave].elisp_eval( "(elt #{object_variable} #{i.to_elisp})" ) end object[:slave].elisp_exec( "(makunbound #{object_variable.to_elisp})" ) return object_array end |