def sfind(sexp, specs)
      specs.inject(sexp) do |node, spec|
        return NotFound if node.nil?

        if spec.is_a?(Symbol) && node.type == spec
          node
        elsif spec.is_a?(Integer) && node.children.length > spec
          node.children[spec]
        elsif spec.is_a?(Array)
          node.children.grep(AST::Node)
            .flat_map { |child| sfind(child, spec) }
            .reject { |child| child == NotFound }
        else
          return NotFound
        end
      end
    end
def sfind(sexp, specs)
      specs.inject(sexp) do |node, spec|
        return NotFound if node.nil?

        if spec.is_a?(Symbol) && node.type == spec
          node
        elsif spec.is_a?(Integer) && node.children.length > spec
          node.children[spec]
        elsif spec.is_a?(Array)
          node.children.grep(AST::Node)
            .flat_map { |child| sfind(child, spec) }
            .reject { |child| child == NotFound }
        else
          return NotFound
        end
      end
    end
Traverse into sexp by type and child position