A toy dynamic programming language written in Ruby
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

array.rb 255B

123456789101112131415
  1. class AST::Array
  2. attr_reader :elements
  3. def initialize(elements)
  4. @elements = elements
  5. end
  6. def ==(other)
  7. other.is_a?(AST::Array) && other.elements == @elements
  8. end
  9. def execute(env)
  10. @elements.map { |el| el.execute(env) }
  11. end
  12. end