lean4-htt/tests/compiler/534.lean
Kim Morrison 1ce7047bf5
feat: cleanup of get and back functions on List/Array (#7059)
This PR moves away from using `List.get` / `List.get?` / `List.get!` and
`Array.get!`, in favour of using the `GetElem` mediated getters. In
particular it deprecates `List.get?`, `List.get!` and `Array.get?`. Also
adds `Array.back`, taking a proof, matching `List.getLast`.
2025-02-17 01:43:45 +00:00

12 lines
253 B
Text

def foo (array : Array Nat) : Nat -> Nat
| 0 => 0
| n + 1 =>
let array := array.filter (!.==5)
if array.isEmpty then
0
else
let arrayOfLast := #[array.back!]
foo arrayOfLast n
def main : IO Unit :=
IO.println ("hi")