> i think worrying about indexes is too low level when we don't actually want to deal with
> numbers.

I agree.

It's an Interesting problem.  I came up with the following way, but
it's sort of ugly.  Too bad there isn't a syntax for calling methods
w/ multiple blocks.

class Array
  def borders(head = nil, tail = nil, &block)
    a = self.dup
    if head
      head[a.shift]
    end
    if tail
      t = a.pop
    end
    a.each &block
    if tail
      tail[t]
    end
  end
end

You just give optional blocks for what to do on the first and last
iterations.  Actually it would probably be better if you specified
them by keyword, but it's already ugly enough as is =)

x = [1,2,3,4,5,6,7]

x.borders(
  lambda do |h|
    puts h * 10
  end,
  lambda do |t|
    puts t + 3
  end)   do |i|
    puts i
end


-- 
Lou.