when looping, using each, i find i am often wonton of a few nice
"sugers" myself.

1. first iteration - do this first thing, but never again

2. last iteration - do this last (same as else i think)

3. not last iteration - do for every iteration BUT the last (this one
would be very useful!!!!

4. not first - you get the idea

5. an automatic index counter - i'm doing an arr.each but i also need a
count too.

6. and of course the few mentioned in the for...each...end thread
concerning breaks or success (though i don't find these as useful as the
above)

but there's no way in hell we can get all these things into blocks as we
know them today. perhaps there's a new kind of looping contruct waiting
to be phathomed by us that can do all this (and more?)

~transmi

iterate x in arr
do
  ...
when _i == 1    # first
  ...
when _i == -1   # last
 ...
when _i != -1   # all but last
 ...
when _i != 1    # all but first
 ...
do
 ...
when _i == nil  # if arr is empty? and perhaps nil? (else?)
 ...
ensure          # on break and success?
 ...  
end

_i is the automatic index (in this case _i started with 1, but probably
0 is better. of course its useable in the code,) notice the do's, which
like the when's, can go in any order. the loop is proccessed in order
dependent on the when conditions. do's of course have no conditions. and
there's no reason other conditions can't be used based on other
variables.

did i miss anything? well you get the idea. what do you think?

could there be a block form?

arr.iterate { |x|
 ...
} _i == 1 {
 ...
} _i == -1 {
 ...
} _i != -1 {
 ...
} _1 != 1 {
 ...
} {
 ...
} _i == nil {
 ...
} ..etc.?....

just some thoughts....

~transami