Handbook
Glossary
sequence
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Sequence protocol
Next:
sequence? ( object -- ? )
Vocabulary
sequences
Class description
A mixin class whose instances are sequences. Custom implementations of the sequence protocol should be declared as instances of this mixin for all sequence functionality to work correctly:
INSTANCE: my-sequence sequence
Definition
USING:
arrays
benchmark.tuple-arrays
bit-arrays
byte-arrays
calendar.ranges
game.input.dinput.keys-array
game.models.util
gml.types
grouping
grouping.private
growable
math.blas.matrices
math.vectors.simd
named-tuples
nibble-arrays
raylib
sequences.complex
sequences.complex-components
sequences.product
sequences.shifted
sequences.windowed
specialized-arrays
strings
tensors
xml.data
zim
;
IN:
sequences
MIXIN:
sequence
INSTANCE:
immutable-sequence
sequence
INSTANCE:
virtual-sequence
sequence
INSTANCE:
array
sequence
INSTANCE:
byte-array
sequence
INSTANCE:
growable
sequence
INSTANCE:
string
sequence
INSTANCE:
chunking
sequence
INSTANCE:
circular-clumps
sequence
INSTANCE:
specialized-array
sequence
INSTANCE:
bit-array
sequence
INSTANCE:
product-sequence
sequence
INSTANCE:
tag
sequence
INSTANCE:
xml
sequence
INSTANCE:
xml-chunk
sequence
INSTANCE:
keys-array
sequence
INSTANCE:
char-16
sequence
INSTANCE:
uchar-16
sequence
INSTANCE:
short-8
sequence
INSTANCE:
ushort-8
sequence
INSTANCE:
int-4
sequence
INSTANCE:
uint-4
sequence
INSTANCE:
longlong-2
sequence
INSTANCE:
ulonglong-2
sequence
INSTANCE:
float-4
sequence
INSTANCE:
double-2
sequence
INSTANCE:
named-tuple
sequence
INSTANCE:
nibble-array
sequence
INSTANCE:
complex-sequence
sequence
INSTANCE:
complex-components
sequence
INSTANCE:
windowed-sequence
sequence
INSTANCE:
point-array
sequence
INSTANCE:
timestamp-range
sequence
INSTANCE:
indexed-seq
sequence
INSTANCE:
proc
sequence
INSTANCE:
blas-matrix-rowcol-sequence
sequence
INSTANCE:
Vector2
sequence
INSTANCE:
Vector3
sequence
INSTANCE:
Vector4
sequence
INSTANCE:
shifted
sequence
INSTANCE:
tensor
sequence
INSTANCE:
zim-cluster
sequence
INSTANCE:
zim
sequence
Methods
USING:
core-foundation
core-foundation.arrays
core-foundation.utilities
sequences
;
M:
sequence
(>cf)
[
(>cf)
&CFRelease
]
map
<CFArray>
;
USING:
kernel
sequences
yaml.private
;
M:
sequence
(deref-aliases)
[
(deref-aliases)
]
with
map!
;
USING:
bootstrap.image.private
kernel
sequences
;
M:
sequence
(eql?)
[
[
length
]
same?
]
2check
[
[
eql?
]
2all?
]
[
2drop
f
]
if
;
USING:
gml.types
kernel
sequences
;
M:
sequence
(gml-get)
swap
wrap
nth
;
USING:
gml.types
sequences
;
M::
sequence
(gml-put)
( collection key elt -- )
elt key collection
wrap
set-nth
;
USING:
kernel
sequences
yaml.private
;
M:
sequence
(replace-aliases)
[
?replace-aliases
]
with
map
;
USING:
kernel
sequences
yaml.private
;
M:
sequence
(replace-anchors)
[
?replace-anchors
]
with
map
;
USING:
assocs
http.client.post-data.private
kernel
sequences
;
M:
sequence
(set-post-data-headers)
length
"content-length"
pick
set-at
;
USING:
http.client.post-data.private
io
sequences
;
M:
sequence
(write-post-data)
write
;
USING:
kernel
math.order
sequences
sequences.private
;
M:
sequence
<=>
[
mismatch
]
2keep
pick
[
2nth-unsafe
<=>
]
[
[
length
]
compare
nip
]
if
;
USING:
accessors
kernel
mongodb.msg
sequences
;
M:
sequence
<mdb-insert-msg>
[
mdb-insert-msg
new
]
2dip
[
>>collection
]
dip
>>objects
OP_Insert
>>opcode
;
USING:
accessors
kernel
mongodb.msg
sequences
;
M:
sequence
<mdb-killcursors-msg>
[
mdb-killcursors-msg
new
]
dip
[
length
>>cursors#
]
keep
>>cursors
OP_KillCursors
>>opcode
;
inline
USING:
io.pipes.private
math
sequences
;
M:
sequence
<pipes>
[
{
}
]
[
length
1
-
<pipes>
]
if-empty
;
USING:
math.matrices
sequences
;
M:
sequence
<square-cols>
<square-rows>
flip
;
USING:
arrays
kernel
math.matrices
sequences
;
M:
sequence
<square-rows>
[
length
]
keep
>array
[
clone
]
curry
{
}
replicate-as
;
USING:
assocs
sequences
;
M:
sequence
>alist
;
inline
USING:
bencode
sequences
;
M:
sequence
>bencode
[
>bencode
]
map
concat
"l"
"e"
surround
;
USING:
arrays.shaped
kernel
sequences
sequences.deep
;
M:
sequence
>col-array
[
flatten
]
[
shape
]
bi
<col-array>
;
USING:
kernel
lists
lists.lazy
sequences
;
M:
sequence
>list
0
swap
sequence-tail>list
;
USING:
math.matrices.extras.private
sequences
;
M:
sequence
>scale-factors
first3
;
USING:
arrays.shaped
kernel
sequences
sequences.deep
;
M:
sequence
>shaped-array
[
{
}
flatten-as
]
[
shape
]
bi
<shaped-array>
;
USING:
sequences
splitting
txon
;
M:
sequence
>txon
[
>txon
]
map
join-lines
;
USING:
combinators
kernel
sequences
xml.syntax.inverse
;
M:
sequence
[undo-xml]
remove-blanks
[
length
]
[
[
[undo-xml]
]
{
}
map-as
]
bi
[
[
[
remove-blanks
]
]
dip
[
firstn-strong
]
curry
compose
]
dip
[
spread
]
curry
compose
;
USING:
containers
sequences
;
M:
sequence
add
push
;
USING:
kernel
sequences
sets
;
M:
sequence
adjoin
[
delete
]
[
push
]
2bi
;
USING:
hash-sets
kernel
sequences
sets
;
M:
sequence
all-unique?
dup
length
<hash-set>
[
?adjoin
]
curry
all?
;
USING:
kernel
sequences
yaml.private
;
M:
sequence
apply-merge-keys
[
?apply-merge-keys
]
with
map!
;
USING:
arrays.shaped
kernel
sequences
;
M:
sequence
array-replace
dup
flat?
[
length
]
[
[
array-replace
]
map
]
if
;
USING:
assocs
kernel
sequences
;
M:
sequence
assoc-clone-like
[
>alist
]
dip
clone-like
;
inline
USING:
assocs
kernel
sequences
;
M:
sequence
assoc-like
[
>alist
]
dip
like
;
inline
USING:
assocs
sequences
;
M:
sequence
assoc-size
length
;
inline
USING:
compiler.tree.propagation.constraints
sequences
;
M:
sequence
assume*
[
assume
]
each
;
USING:
assocs
assocs.private
kernel
sequences
;
M:
sequence
at*
search-alist
[
second
t
]
[
f
]
if
;
USING:
cursors
sequences
;
M:
sequence
begin-cursor
0
<sequence-cursor>
;
inline
USING:
combinators
cuda.libraries.private
kernel
sequences
;
M:
sequence
block-dim
dup
length
{
{
0
[
drop
1 1 1
]
}
{
1
[
first
1 1
]
}
{
2
[
first2
1
]
}
[
drop
first3
]
}
case
;
inline
USING:
kernel
sequences
sequences.deep
;
M:
sequence
branch?
drop
t
;
USING:
sequences
sets
;
M:
sequence
cardinality
fast-set
cardinality
;
USING:
irc.client.internals
kernel
sequences
;
M:
sequence
chat-put
[
chat-put
]
with
each
;
USING:
arrays.shaped
kernel
sequences
;
M:
sequence
check-underlying-shape
2dup
[
length
]
[
shape-capacity
]
bi*
=
[
underlying-shape-mismatch
]
unless
;
inline
USING:
assocs
sequences
;
M:
sequence
clear-assoc
delete-all
;
inline
USING:
sequences
sets
;
M:
sequence
clear-set
delete-all
;
inline
USING:
kernel
sequences
sequences.private
;
M:
sequence
clone-like
dupd
new-sequence-like
[
0
swap
copy-unsafe
]
keep
;
inline
USING:
containers
sequences
;
M:
sequence
clone-like
clone-like
;
USING:
math.matrices
math.matrices.private
sequences
;
M:
sequence
cols-except
sequence-except-quot
simple-cols-except
;
USING:
containers
sequences
;
M:
sequence
contains?
member?
;
USING:
containers
sequences
;
M:
sequence
count
length
;
USING:
fry.private
sequences
;
M:
sequence
count-inputs
[
count-inputs
]
map-sum
;
USING:
sequences
tools.coverage
;
M:
sequence
coverage.
[
first2
pair-coverage.
]
each
;
USING:
scryfall
sequences
;
M:
sequence
deck-and-sideboard.
deck.
;
USING:
scryfall
sequences
;
M:
sequence
deck.
cards.
;
USING:
kernel
sequences
sets
;
M:
sequence
delete
remove!
drop
;
inline
USING:
assocs
assocs.private
kernel
sequences
;
M:
sequence
delete-at
[
nip
]
[
search-alist
nip
]
2bi
[
swap
remove-nth!
drop
]
[
drop
]
if*
;
USING:
dns
kernel
sequences
tools.dns
;
M:
sequence
dns-host
[
host
]
curry
with-dns-servers
;
USING:
docker
sequences
;
M:
sequence
docker-pull
[
docker-pull
]
each
;
USING:
graphviz.dot.private
io
sequences
;
M:
sequence
dot.
"{"
print
[
dot.
";"
print
]
each
"}"
print
;
USING:
hash-sets
kernel
sequences
sets
;
M:
sequence
duplicates
dup
length
<hash-set>
[
?adjoin
]
curry
reject
;
USING:
combinators.extras
kernel
namespaces
sequences
yaml.config
yaml.ffi
yaml.private
;
M:
sequence
emit-value
[
drop
YAML_SEQ_TAG
implicit-tags
get
emit-sequence-start
]
[
nip
emit-sequence-body
]
[
2drop
emit-sequence-end
]
4tri
;
USING:
cursors
kernel
sequences
;
M:
sequence
end-cursor
dup
length
<sequence-cursor>
;
inline
USING:
compiler.cfg.gvn.testing
prettyprint
sequences
splitting
;
M:
sequence
expr>str
[
unparse
]
map
join-words
;
USING:
hash-sets
sequences
sets
;
M:
sequence
fast-set
>hash-set
;
USING:
fry
fry.private
kernel
quotations
sequences
;
M:
sequence
fry
[
0
swap
new-sequence
]
keep
[
1quotation
]
[
(fry)
swap
[
like
]
curry
append
]
if-empty
;
USING:
fuel.pprint
fuel.pprint.private
sequences
;
M:
sequence
fuel-pprint
"("
")"
fuel-pprint-sequence
;
inline
USING:
benchmark.dispatch3
kernel
sequences
;
M:
sequence
g
drop
"sequence"
;
USING:
combinators
cuda.libraries.private
kernel
sequences
;
M:
sequence
grid-dim
dup
length
{
{
0
[
drop
1 1
]
}
{
1
[
first
1
]
}
[
drop
first2
]
}
case
;
inline
USING:
kernel
math
sequences
;
M:
sequence
hashcode*
[
sequence-hashcode
]
recursive-hashcode
;
USING:
accessors
formatting
help.lint.coverage
kernel
math
sequences
;
M:
sequence
help-coverage.
[
[
help-coverage.
]
each
]
[
[
[
100%-coverage?>>
]
count
]
[
length
]
bi
/f
100
*
"\n%3.1f%% of words have complete documentation\n"
printf
]
bi
;
recursive
USING:
classes
sequences
sets
;
M:
sequence
implementors
[
implementors
]
gather
;
USING:
sequences
sets
;
M:
sequence
in?
member?
;
inline
USING:
gap-buffer
kernel
sequences
;
M:
sequence
insert*
prepare-insert
[
insert-elements
]
2keep
swap
length
increment-gap-start
;
USING:
sequences
sequences.private
sorting
sorting.private
;
M:
sequence
inv-sort-keys
0
check-bounds
[
first-unsafe
]
inv-sort-by
;
USING:
sequences
sequences.private
sorting
sorting.private
;
M:
sequence
inv-sort-values
1
check-bounds
[
second-unsafe
]
inv-sort-by
;
USING:
containers
sequences
;
M:
sequence
items
;
USING:
kernel
math
sequences
;
M:
sequence
lengthen
[
length
>
]
2check
[
set-length
]
[
2drop
]
if
;
inline
USING:
kernel
sequences
;
M:
sequence
like
drop
;
inline
USING:
containers
sequences
;
M:
sequence
like
like
;
USING:
containers
sequences
;
M:
sequence
lookup
nth
;
USING:
assocs
mirrors
sequences
;
M:
sequence
make-mirror
<enumerated>
;
USING:
math.order
sequences
;
M:
sequence
maximum
[
]
[
max
]
map-reduce
;
inline
USING:
kernel
sequences
sets
;
M:
sequence
members
f
fast-set
[
?adjoin
]
curry
filter
;
USING:
sequences
yaml.private
;
M:
sequence
merge-value
merge-values
merge-value
;
USING:
math.order
sequences
;
M:
sequence
minimum
[
]
[
min
]
map-reduce
;
inline
USING:
assocs
kernel
sequences
vectors
;
M:
sequence
new-assoc
drop
<vector>
;
inline
USING:
kernel
persistent.sequences
sequences
;
M:
sequence
new-nth
clone
[
set-nth
]
keep
;
USING:
kernel
sequences
vectors
;
M:
sequence
new-resizable
drop
<vector>
;
inline
USING:
sequences
sequences.private
;
M:
sequence
nth
bounds-check
nth-unsafe
;
inline
USING:
sequences
sequences.private
;
M:
sequence
nth-unsafe
nth
;
inline
USING:
sequences
sets
;
M:
sequence
null?
empty?
;
inline
USING:
make
pdf.values
sequences
;
M:
sequence
pdf-value
[
"["
%
[
pdf-value
%
" "
%
]
each
"]"
%
]
""
make
;
USING:
persistent.sequences
sequences
;
M:
sequence
ppop
but-last
;
USING:
io
json.prettyprint.private
namespaces
sequences
;
M:
sequence
pprint-json*
[
"[ ]"
write
]
[
"["
print
indent-level
inc
[
","
print
]
[
write-spaces
pprint-json*
]
interleave
nl
indent-level
dec
write-spaces
"]"
write
]
if-empty
;
USING:
kernel
persistent.sequences
sequences
;
M:
sequence
ppush
swap
suffix
;
USING:
kernel
make
sequences
xml.data
xml.syntax.private
;
M:
sequence
push-item
dup
xml-data?
[
,
]
[
[
push-item
]
each
]
if
;
USING:
math.statistics.running
sequences
;
M:
sequence
push-value
[
push-value
]
each
;
USING:
kernel
random
sequences
;
M:
sequence
random*
[
f
]
swap
[
[
length
]
]
dip
[
random*
]
curry
compose
[
keep
nth
]
curry
if-empty
;
USING:
containers
kernel
sequences
;
M:
sequence
remove
remove-nth!
drop
;
USING:
containers
sequences
;
M:
sequence
remove-all
delete-all
;
USING:
match
sequences
;
M:
sequence
replace-patterns
[
replace-patterns
]
map
;
USING:
retries
sequences
;
M:
sequence
retries*
<sequence-retries>
;
USING:
kernel
locals.rewrite
make
sequences
;
M:
sequence
rewrite-element
dup
rewrite-literal?
[
rewrite-sequence
]
[
,
]
if
;
USING:
locals.rewrite
sequences
;
M:
sequence
rewrite-literal?
[
rewrite-literal?
]
any?
;
USING:
locals.rewrite
sequences
;
M:
sequence
rewrite-sugar*
rewrite-element
;
USING:
math.matrices
math.matrices.private
sequences
;
M:
sequence
rows-except
sequence-except-quot
simple-rows-except
;
USING:
assocs
lint.private
sequences
;
M:
sequence
run-lint
[
lint
]
zip-with
trim-self
[
second
empty?
]
reject
filter-symbols
;
USING:
kernel
quiz
random
sequences
sequences.extras
;
M:
sequence
run-multiple-choice-quiz
[
[
random
]
curry
]
dip
[
<multiple-choice-question>
run-one-question
]
curry
compose
loop>array
;
USING:
kernel
quiz
random
sequences
sequences.extras
;
M:
sequence
run-quiz
[
random
>question
run-one-question
]
curry
loop>array
;
USING:
io
sequences
tools.scaffold
;
M:
sequence
scaffold-docs
[
scaffold-word-docs
nl
]
each
;
USING:
boyer-moore
boyer-moore.private
kernel
sequences
;
M:
sequence
search-from
[
2drop
0
]
[
<boyer-moore>
(search-from)
]
if-empty
;
USING:
gml.viewer
sequences
;
M:
sequence
selected-vectors
[
selected-vectors
]
map
concat
;
USING:
sequences
smalltalk.selectors
;
M:
sequence
selector-at:
nth
;
USING:
kernel
sequences
smalltalk.selectors
;
M:
sequence
selector-at:put:
[
swapd
set-nth
]
keep
;
USING:
kernel
math
sequences
sequences.seq
;
M:
sequence
seq-lengthen
2dup
lengthd
<
[
seq-set-length
]
[
drop
]
if
;
inline
USING:
kernel
math
sequences
sequences.seq
;
M:
sequence
seq-shorten
2dup
lengthd
>
[
seq-set-length
]
[
drop
]
if
;
inline
USING:
arrays
assocs
assocs.private
kernel
sequences
;
M:
sequence
set-at
2dup
search-alist
[
2nip
set-second
]
[
drop
[
swap
2array
]
dip
push
]
if
;
USING:
kernel
sequences
sets
;
M:
sequence
set-like
[
members
]
dip
like
;
USING:
sequences
sequences.private
;
M:
sequence
set-nth
bounds-check
set-nth-unsafe
;
inline
USING:
sequences
sequences.private
;
M:
sequence
set-nth-unsafe
set-nth
;
inline
USING:
escape-strings
sequences
;
M:
sequence
sha1-escape-strings
[
sha1-escape-string
]
{
}
map-as
;
USING:
arrays.shaped
sequences
;
M:
sequence
shape
array-replace
wrap-shape
;
USING:
arrays.shaped
sequences
;
M:
sequence
shape-capacity
check-shape-domain
product
;
USING:
kernel
math
sequences
;
M:
sequence
shorten
[
length
<
]
2check
[
set-length
]
[
2drop
]
if
;
inline
USING:
sequences
sequences.private
sorting
sorting.private
;
M:
sequence
sort-keys
0
check-bounds
[
first-unsafe
]
sort-by
;
USING:
sequences
sequences.private
sorting
sorting.private
;
M:
sequence
sort-values
1
check-bounds
[
second-unsafe
]
sort-by
;
USING:
io
json
kernel
sequences
;
M:
sequence
stream-write-json
91
over
stream-write1
swap
over
[
[
44
]
]
dip
[
stream-write1
]
curry
compose
pick
[
stream-write-json
]
curry
interleave
93
swap
stream-write1
;
USING:
alien.strings
io.encodings.utf8
sequences
;
M:
sequence
string>symbol
[
utf8
string>alien
]
map
;
USING:
kernel
sequences
summary
;
M:
sequence
summary
dup
length
"elements"
container-summary
;
USING:
classes
classes.private
generic
kernel
sequences
;
M:
sequence
update-methods
implementors
[
update-generic
]
with
each
;
USING:
io.launcher
sequences
;
M:
sequence
wait-for-success
[
wait-for-success
]
each
;
USING:
kernel
modern.html
sequences
;
M:
sequence
walk-html
[
walk-html
]
curry
each
;
USING:
db.queries
kernel
nmake
sequences
;
M:
sequence
where
[
[
" or "
0%
]
[
dupd
where
]
interleave
drop
]
in-parens
;
USING:
arrays
arrays.shaped
grouping
kernel
sequences
;
M:
sequence
wrap-shape
dup
all-equal?
[
[
length
]
[
first
]
bi
2array
<uniform-shape>
]
[
<abnormal-shape>
]
if
;
USING:
cbor
cbor.private
kernel
sequences
;
M:
sequence
write-cbor
dup
length
4
write-integer
[
write-cbor
]
each
;
USING:
csexp
io
sequences
;
M:
sequence
write-csexp
40
write1
[
write-csexp
]
each
41
write1
;
USING:
modern.html
sequences
;
M:
sequence
write-html
[
write-html
]
each
;
USING:
kernel
msgpack
msgpack.private
sequences
;
M:
sequence
write-msgpack
dup
length
write-array-header
[
write-msgpack
]
each
;
USING:
html.components.private
sequences
;
M:
sequence
write-nested
[
write-nested
]
each
;
USING:
formatting
kernel
redis.command-writer.private
sequences
;
M:
sequence
write-resp
[
length
"*%s\r\n"
printf
]
keep
[
write-resp
]
each
;
USING:
make
modern.html
sequences
;
M:
sequence
write-string
[
write-string
"\n"
%
]
each
;
USING:
sequences
xml.writer
;
M:
sequence
write-xml
[
write-xml
]
each
;
USING:
kernel
modern.html
sequences
;
M:
sequence
xml-find-by
[
xml-find-by
]
curry
map-find
drop
;