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 )
Precondition
pre
  T : property.equatable
0.095dev (GIT hash 09dff08de289bbb6f7136c7e2f8c66dcc1856bba)
last changed: 2026-04-16