@[inline]
def
Array.binSearch
{α : Type}
[inst : Inhabited α]
(as : Array α)
(k : α)
(lt : α → α → Bool)
(lo : optParam Nat 0)
(hi : optParam Nat (Array.size as - 1))
:
Option α
Equations
- Array.binSearch as k lt lo hi = if lo < Array.size as then let hi := if hi < Array.size as then hi else Array.size as - 1; Array.binSearchAux lt id as k lo hi else none
@[inline]
def
Array.binInsert
{α : Type u}
[inst : Inhabited α]
(lt : α → α → Bool)
(as : Array α)
(k : α)
:
Array α
Equations
- Array.binInsert lt as k = Id.run (Array.binInsertM lt (fun x => k) (fun x => k) as k)