Class: Range

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#%(step) ⇒ Object

static VALUE step_each( VALUE self ) {

VALUE  a;
double beg, step;
size_t i, size;

a = nary_step_parameters( self, Qnil );
beg  = NUM2DBL(RARRAY_PTR(a)[0]);
step = NUM2DBL(RARRAY_PTR(a)[1]);
size = NUM2SIZET(RARRAY_PTR(a)[2]);

for (i=0; i<size; i++) {
    rb_yield(rb_float_new(beg+i*step));
}
return self;

}



436
437
438
439
440
# File 'ext/numo/narray/step.c', line 436

static VALUE
range_with_step( VALUE range, VALUE step )
{
    return nary_step_new2( range, step, Qnil );
}

#*(len) ⇒ Object



442
443
444
445
446
# File 'ext/numo/narray/step.c', line 442

static VALUE
range_with_length( VALUE range, VALUE len )
{
    return nary_step_new2( range, Qnil, len );
}