Skip to content

Commit

Permalink
Working implementation of R::Seq::Array.
Browse files Browse the repository at this point in the history
Some other breakages to clear up.
  • Loading branch information
Arlen Christian Mart Cuss committed Nov 12, 2012
1 parent 6b14229 commit 312aa9c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/rouge/seq.rb
Expand Up @@ -59,7 +59,8 @@ def [](i)
end

def ==(seq)
seq.is_a?(ISeq) and self.to_a == seq.to_a
(seq.is_a?(ISeq) and self.to_a == seq.to_a) or
(seq.is_a?(::Array) and self.to_a == seq)
end

def each(&block)
Expand Down Expand Up @@ -145,6 +146,16 @@ class Array
def initialize(array, i)
@array, @i = array, i
end

def first
@array[@i]
end

def next
if @i + 1 < @array.length
Array.new(@array, @i + 1)
end
end
end

def self.seq(form)
Expand Down

0 comments on commit 312aa9c

Please sign in to comment.