lean4-htt/tests/lean/run/getOp.lean
2022-07-02 07:29:58 -07:00

22 lines
399 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def MyArray := Array
namespace MyArray
def getOp? (self : MyArray α) (idx : Nat) : Option α :=
Array.get? self idx
def getOp! [Inhabited α] (self : MyArray α) (idx : Nat) : α :=
Array.get! self idx
def getOp (self : MyArray α) (idx : Fin self.size) : α :=
Array.get self idx
end MyArray
variable (a : MyArray Nat)
#check a[0]!
#check a[0]?
variable (i : Fin a.size)
#check a[i]