Faster <range>
parent
24b8bc5a4f
commit
2798de019a
|
@ -1,3 +1,5 @@
|
||||||
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel layouts math math.order namespaces sequences
|
USING: kernel layouts math math.order namespaces sequences
|
||||||
sequences.private accessors ;
|
sequences.private accessors ;
|
||||||
IN: math.ranges
|
IN: math.ranges
|
||||||
|
@ -8,9 +10,7 @@ TUPLE: range
|
||||||
{ step read-only } ;
|
{ step read-only } ;
|
||||||
|
|
||||||
: <range> ( a b step -- range )
|
: <range> ( a b step -- range )
|
||||||
[ over - ] dip
|
[ over - ] dip [ /i 1+ 0 max ] keep range boa ; inline
|
||||||
[ / 1+ 0 max >integer ] keep
|
|
||||||
range boa ; inline
|
|
||||||
|
|
||||||
M: range length ( seq -- n )
|
M: range length ( seq -- n )
|
||||||
length>> ;
|
length>> ;
|
||||||
|
|
Loading…
Reference in New Issue