class Array
def couple()
(length-1).times { |n| yield(at(n), at(n+1)) }
end
end
Which *seems* to work, albeit throwing complaints all the way. And it does the a,b;b,c;c,d sort of thing with a list...
0.upto(infinity) { puts "Ruby is cool" } One Person's travel towards maturity.
class Array
def couple()
(length-1).times { |n| yield(at(n), at(n+1)) }
end
end
No comments:
Post a Comment