Handbook
Glossary
inside-zbox ( seq Z l r k -- seq Z l r )
Vocabulary
z-algorithm
.
private
Inputs
seq
an
object
Z
an
object
l
an
object
r
an
object
k
an
object
Outputs
seq
an
object
Z
an
object
l
an
object
r
an
object
Definition
USING:
kernel
math
sequences
z-algorithm
;
IN:
z-algorithm.private
::
inside-zbox
( seq Z l r k -- seq Z l r )
k l
-
Z
nth
:>
Zk' r k
-
1
+
:>
b seq Z Zk' b
<
[
Zk' k Z
set-nth
l r
]
[
seq r 1
+
seq b
[
tail-slice
]
2bi@
lcp
:>
q q b
+
k Z
set-nth
k q r
+
]
if
;
inline