Handbook
Glossary
virtual@ ( n seq -- n' seq' )
Virtual sequence protocol
Prev:
virtual-exemplar ( seq -- seq' )
Vocabulary
sequences
Inputs
n
an
integer
seq
a
sequence
Outputs
n'
an
integer
seq'
a
sequence
Word description
Part of the sequence protocol, this word translates the input index
n
into an index and the underlying storage this index points into.
Examples
USING: kernel prettyprint sequences ; 0 { 1 2 3 4 5 6 } <reversed> virtual@ [ . ] bi@
5 { 1 2 3 4 5 6 }
Definition
IN:
sequences
GENERIC:
virtual@
( n seq -- n' seq' )
Methods
USING:
accessors
kernel
math
math.blas.vectors
math.blas.vectors.private
sequences
;
M:
blas-vector-base
virtual@
[
inc>>
*
]
[
nip
(blas-direct-array)
]
2bi
;
USING:
accessors
grouping
kernel
math
sequences
;
M:
circular-slice
virtual@
[
from>>
+
]
[
seq>>
]
bi
[
length
rem
]
keep
;
inline
USING:
accessors
circular
circular.private
sequences
;
M:
circular
virtual@
circular-wrap
seq>>
;
inline
USING:
accessors
columns
kernel
sequences
;
M:
column
virtual@
[
col>>
swap
]
[
seq>>
]
bi
nth
bounds-check
;
USING:
accessors
kernel
math
sequences
;
M:
composed
virtual@
2dup
first>>
length
<
[
first>>
]
[
[
first>>
length
-
]
[
second>>
]
bi
]
if
;
USING:
accessors
kernel
math
sequences
sequences.cords
;
M:
cord
virtual@
2dup
head>>
length
<
[
head>>
]
[
[
head>>
length
-
]
[
tail>>
]
bi
]
if
;
inline
USING:
accessors
sequences
sequences.repeating
;
M:
cycles
virtual@
circular>>
;
USING:
accessors
kernel
math
sequences
sequences.repeating
;
M:
element-repeats
virtual@
[
times>>
/i
]
[
seq>>
]
bi
;
USING:
accessors
kernel
math
sequences
sequences.extras
;
M:
evens
virtual@
[
2
*
]
[
seq>>
]
bi*
;
inline
USING:
accessors
gap-buffer
kernel
sequences
;
M:
gb
virtual@
[
position>index
]
keep
seq>>
;
USING:
accessors
kernel
math
sequences
sequences.merged
sequences.private
;
M:
merged
virtual@
seqs>>
[
length
/mod
]
[
nth-unsafe
]
bi
;
inline
USING:
accessors
kernel
math
sequences
sequences.extras
;
M:
odds
virtual@
[
2
*
1
+
]
[
seq>>
]
bi*
;
inline
USING:
accessors
kernel
math
sequences
sequences.inserters
;
M:
offset-growable
virtual@
[
offset>>
+
]
[
underlying>>
]
bi
;
inline
USING:
accessors
kernel
math
sequences
;
M:
reversed
virtual@
seq>>
[
length
swap
-
1
-
]
keep
;
inline
USING:
accessors
kernel
math
sequences
sequences.rotated
;
M:
rotated
virtual@
[
n>>
+
]
[
seq>>
]
bi
[
length
over
0
<
[
+
]
[
2dup
>=
[
-
]
[
drop
]
if
]
if
]
keep
;
USING:
accessors
kernel
math
sequences
;
M:
slice
virtual@
[
from>>
+
]
[
seq>>
]
bi
;
inline
USING:
accessors
kernel
math
sequences
sequences.snipped
;
M:
snipped
virtual@
[
[
from>>
dupd
>=
]
keep
[
length>>
+
]
curry
when
]
[
seq>>
]
bi
;
USING:
accessors
kernel
math
sequences
sequences.extras
;
M:
step-slice
virtual@
[
step>>
*
]
[
from>>
+
]
[
seq>>
]
tri
;
inline
USING:
accessors
sequences
;
M:
wrapped-sequence
virtual@
seq>>
;
inline