def next_word
import mylsm-lsm-store@0.6.0.1/src/hub_sha/core.bend as Coreimport Base
85# Schedule histories always contain at least 16 words. Destructuring that prefix
86# avoids four independent linked-list walks for every expanded word; the fallback
87# preserves the total behavior used by the universal refinement theorem.
88def next_word(+history: List<&2, U32>) -> U32:
89 match history:
90 case a <> b <> c <> d <> e <> f <> g <> h <> i <> j <> k <> l <> m <> n <> o <> (p <> rest):
91 (small1(b) + g + small0(o) + p : U32)
92 case _:
93 next_word_slow(history)