feat: size of a LocalContext

This commit is contained in:
Scott Morrison 2022-07-19 14:24:21 +10:00 committed by Leonardo de Moura
parent b9c0fd2ab3
commit aeeaaa6efc

View file

@ -318,6 +318,9 @@ instance : ForIn m LocalContext LocalDecl where
@[inline] def foldr (lctx : LocalContext) (f : LocalDecl → β → β) (init : β) : β :=
Id.run <| lctx.foldrM f init
def size (lctx : LocalContext) : Nat :=
lctx.foldl (fun n _ => n+1) 0
@[inline] def findDecl? (lctx : LocalContext) (f : LocalDecl → Option β) : Option β :=
Id.run <| lctx.findDeclM? f