Handbook
Glossary
<boyer-moore> ( pattern -- boyer-moore )
Vocabulary
boyer-moore
Inputs
pattern
a
sequence
Outputs
boyer-moore
a
boyer-moore
Word description
Given a pattern performs pattern preprocessing and returns results as an (opaque) object that is reusable across searches in different sequences via
search-from
.
Examples
USING: boyer-moore prettyprint ; "abc" <boyer-moore> .
T{ boyer-moore { pattern "abc" } { bad-char-table H{ { 97 0 } { 98 -1 } { 99 -2 } } } { good-suffix-table { 3 3 1 } } }
Definition
USING:
boyer-moore.private
kernel
sequences
;
IN:
boyer-moore
:
<boyer-moore>
( pattern -- boyer-moore )
dup
<reversed>
[
<bad-char-table>
]
[
<good-suffix-table>
]
bi
boyer-moore
boa
;