type BTreeIs (BTreeIsBranch( U64 , k , v , BTreeIs[] , BTreeIs[] )) | BTreeIsEOF; type BTreeEq (BTreeEqBranch( U64 , k , v , BTreeEq[] , BTreeEq[] )) | BTreeEqEOF; .lookup := λ(: index BTreeIs)(: k k)(: default v). (: ( (let th (hash k)) (let continue True_u8) (while (==( continue True_u8 )) ( (let ih (.5 (as index Tag))) (if (==( th ih )) ( (if (is( k (.4 (as index Tag)) )) ( (set default (.3 (as index Tag))) (set continue False_u8) ) ()) ) ()) (if (==( continue True_u8 )) ( (if (<( ih th )) ( (if (==( (as (.1 (as index Tag)) U64) 0_u64 )) ( (set continue False_u8) ) ( (set index (open(.1 (as index Tag)))) )) ) ( (if (==( (as (.2 (as index Tag)) U64) 0_u64 )) ( (set continue False_u8) ) ( (set index (open(.2 (as index Tag)))) )) )) ) ()) )) default ) v); .lookup := λ(: index BTreeEq)(: k k)(: default v). (: ( (let th (deep-hash k)) (let continue True_u8) (while (==( continue True_u8 )) ( (let ih (.5 (as index Tag))) (if (==( th ih )) ( (if (==( k (.4 (as index Tag)) )) ( (set default (.3 (as index Tag))) (set continue False_u8) ) ()) ) ()) (if (==( continue True_u8 )) ( (if (<( ih th )) ( (if (==( (as (.1 (as index Tag)) U64) 0_u64 )) ( (set continue False_u8) ) ( (set index (open(.1 (as index Tag)))) )) ) ( (if (==( (as (.2 (as index Tag)) U64) 0_u64 )) ( (set continue False_u8) ) ( (set index (open(.2 (as index Tag)))) )) )) ) ()) )) default ) v); .bind := λ(: index BTreeIs[])(: k k)(: v v). (: ( (let ht (hash k)) (let continue True_u8) (let cell (close(BTreeIsBranch( ht k v (as 0_u64 BTreeIs[]) (as 0_u64 BTreeIs[]) )))) (while (==( continue True_u8 )) ( (let flat-index (open index)) (if (<( (.5 (as flat-index Tag)) ht )) ( (if (==( (as (.1 (as flat-index Tag)) U64) 0_u64 )) ( (mov( (as cell U64) R8 )) (set[]( (as index Field,1>[]) 1_u64 R8 )) (set continue False_u8) ) ( (set index (.1 (as flat-index Tag))) )) ) ( (if (==( (as (.2 (as flat-index Tag)) U64) 0_u64 )) ( (mov( (as cell U64) R8 )) (set[]( (as index Field,1>[]) 2_u64 R8 )) (set continue False_u8) ) ( (set index (.2 (as flat-index Tag))) )) )) )) ) Nil); .bind := λ(: index BTreeEq[])(: k k)(: v v). (: ( (let ht (deep-hash k)) (let continue True_u8) (let cell (close(BTreeEqBranch( ht k v (as 0_u64 BTreeEq[]) (as 0_u64 BTreeEq[]) )))) (while (==( continue True_u8 )) ( (let flat-index (open index)) (if (<( (.5 (as flat-index Tag)) ht )) ( (if (==( (as (.1 (as flat-index Tag)) U64) 0_u64 )) ( (mov( (as cell U64) R8 )) (set[]( (as index Field,1>[]) 1_u64 R8 )) (set continue False_u8) ) ( (set index (.1 (as flat-index Tag))) )) ) ( (if (==( (as (.2 (as flat-index Tag)) U64) 0_u64 )) ( (mov( (as cell U64) R8 )) (set[]( (as index Field,1>[]) 2_u64 R8 )) (set continue False_u8) ) ( (set index (.2 (as flat-index Tag))) )) )) )) ) Nil);