Handbook
Glossary
search-from ( seq from obj -- i/f )
Vocabulary
boyer-moore
Inputs
seq
a
sequence
from
a non-negative integer
obj
an
object
Outputs
i/f
the index of first match or
f
Generic word contract
Performs an attempt to find the first occurrence of pattern in
seq
starting from
from
using Boyer-Moore search algorithm. Output is the index if the attempt was succeessful, or
f
otherwise.
Examples
USING: boyer-moore prettyprint ; { 1 2 7 10 20 2 7 10 } 3 { 2 7 10 } search-from .
5
Definition
IN:
boyer-moore
GENERIC:
search-from
( seq from obj -- i/f )
Methods
USING:
boyer-moore
boyer-moore.private
;
M:
boyer-moore
search-from
(search-from)
;
USING:
boyer-moore
boyer-moore.private
kernel
sequences
;
M:
sequence
search-from
[
2drop
0
]
[
<boyer-moore>
(search-from)
]
if-empty
;