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`.
12 lines
253 B
Text
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")
|