Clarify selector anchor boundary cases
This commit is contained in:
1 parent
bb32cca6f9
commit
c8e49aead8
1 file changed
+1
-1
+1
-1
@@ -85,7 +85,7 @@ structure Selector where
|
||||
below `selector.key` (none for the empty key, all of them for `⊤`), minus one,
|
||||
shifted by `selector.offset`. Offset `0` names the last stored key strictly
|
||||
below `selector.key`, which is index `-1` when there is none; offset `1` names
|
||||
the first stored key at or above it; offset `-1` names the key before that. -/
|
||||
the first stored key at or above it, or index `List.length db.keys` when there is none. -/
|
||||
def Selector.anchor (db : DB) (s : Selector) : Int :=
|
||||
(db.keys.countP (fun (k : Key) => decide ((↑k : WithTop Key) < s.key)) : Int)
|
||||
+ s.offset - 1
|
||||
|
||||
Reference in new issue
Block a user