/*
 *  call-seq:
 *     enum.find_index()   {| obj | block }  => int
 *  
 *  Passes each entry in <i>enum</i> to <em>block</em>. Returns the
 *  index for the first for which <em>block</em> is not <code>false</code>.
 *  If no object matches, returns <code>nil</code>
 *     
 *     (1..10).find_index  {|i| i % 5 == 0 and i % 7 == 0 }   #=> nil
 *     (1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 }   #=> 34
 *     
 */

static VALUE
enum_find_index(VALUE obj)
{
    VALUE memo[2];

    RETURN_ENUMERATOR(obj, 0, 0);
    memo[0] = Qundef;
    memo[1] = 0;
    rb_block_call(obj, id_each, 0, 0, find_index_i, (VALUE)memo);
    if (memo[0] != Qundef) {
        return memo[0];
    }
    return Qnil;
}