def peek

bend-ml-bpe-tokenizer@0.1.3.0 · main.bend:40

import bend-ml-bpe-tokenizer@0.1.3.0/main.bend as BendMlBpeTokenizer
import Base

40# does xs start with exactly the pair (a, b)?
41def peek(+a: Tk, +b: Tk, xs: List<&2, Tk>) -> Bool:
42  match xs:
43    case Nil{}:
44      False{}
45    case Con{+x, t}:
46      match t:
47        case Nil{}:
48          False{}
49        case Con{+y, u}:
50          Bool.and(Tk.eq(x, a), Tk.eq(y, b))

Uses (5)

Used by (6)