This PR renames `String.ValidPos` to `String.Pos`, `String.endValidPos` to `String.endPos` and `String.startValidPos` to `String.startPos`. Accordingly, the deprecations of `String.Pos` to `String.Pos.Raw` and `String.endPos` to `String.rawEndPos` are removed early, after an abbreviated deprecation cycle of two releases.
14 lines
354 B
Text
14 lines
354 B
Text
--
|
|
set_option pp.explicit true
|
|
-- set_option trace.compiler.boxed true
|
|
|
|
partial def contains : String → Char → String.Pos.Raw → Bool
|
|
| s, c, i =>
|
|
if s.atEnd i then false
|
|
else if s.get i == c then true
|
|
else contains s c (s.next i)
|
|
|
|
def main : IO Unit :=
|
|
let s1 := "hello";
|
|
IO.println (contains s1 'a' 0) *>
|
|
IO.println (contains s1 'o' 0)
|