Hello,
I want to thank evrybody who answered my questions, all replies where
very friendly and helpful.

In article <wsqn1dgutsw.fsf / eris.io.com>, Jim Menard  <jimm / eris.io.com> wrote:
>I'll try to answer the easy ones.
>
>jmichel / schur.institut.math.jussieu.fr (Jean Michel) writes:
>
>>     the reason why sort! does not return its result for arrays of length
>>     1 eludes me.
>
>sort! returs nil if the message receiver (the array) is not changed, as do
>many (but not all) of the "!" methods.

Even so I am still surprised. How one is to know that in

  [1].sort!

the receiver is not changed, but in

  [1,2].sort!

it is? Not obvious to me...

>>   - I was very surprised that  each_pair is not defined for arrays, only
>>     hashes. Of course you can roll your own:
>
>Try each_with_index instead.
>	...
>
>This method is defined in the Enumeration (or Enumerable) module.
>
I guess I never tried to look there because for me Enumerable was for
classes were just each exists, no ordering (e.g. is each supposed to
go over the same object in the same order each time?). And why is
the name not each_pair?

>>   - I  have some problems with  scopes. In particular, that  one can not
>>   define local functions.  The closest I could come with  is to define a
>>   local Proc object and use .call on it. Is that the recommended way?
>
>That's certainly possible, but we tend to use blocks instead of anonymous
>subroutines.

Could you give an example? To give an example of what I was looking for,
I am in the middle of some method with local variables a,b,c and
I have the same piece of code appearing twice:

   some computations

   print {some complicated debug print_out of the current contents of a,b,c}

   some computations modifying a,b,c

   print {same as above}

Now a,b,c are different classes, and the debug print_out is not associated
especially to any object so in an ordinary programming language (like Pascal)
the best solution would be a local procedure. Is there a better solution
in ruby than what I did:

   debug_print=Proc.new{ the print statement}

   and then do
     debug_print.call

Best regards,
  Jean MICHEL