Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

find

Sequence.find

get the index of pattern within this Sequence or nil if it does not exist

uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf

worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
0.095dev (GIT hash 5a97c5766ea04e5412cbfaed4c53658737cd2e4b)