Handbook
Glossary
slice-parameters ( selector size -- start count step )
Vocabulary
arrays
.
shaped
.
private
Inputs
selector
an
object
size
an
object
Outputs
start
an
object
count
an
object
step
an
object
Definition
USING:
accessors
arrays.shaped
kernel
math
math.order
;
IN:
arrays.shaped.private
::
slice-parameters
( selector size -- start count step )
selector
step>>
[
]
[
1
]
if*
:>
step step
integer?
[
step
zero?
not
]
[
f
]
if
[
selector
invalid-shaped-slice
]
unless
step 0
>
[
selector
start>>
size 0 size 0
slice-bound
selector
stop>>
size 0 size size
slice-bound
]
[
selector
start>>
size -1 size 1
-
size 1
-
slice-bound
selector
stop>>
size -1 size 1
-
-1
slice-bound
]
if
:>
( start stop ) start stop start
-
step
sgn
*
0
max
step
abs
1
-
+
step
abs
/i
step
;