Bendtorch.pt_read: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 3449-3464 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=3449&end_line=3464 import Base # the part at off, of kind k, with its second cell rn already read; fuel bounds the depth (a model's pairs nest far # less than 1000 deep) def pt_read(fuel: Nat, k: PK, +off: U32, rn: Array & F32) -> PTA: match fuel k rn: case 0n _ Tuple{xs, x}: PTA{PNew{False{}}, xs, off} case 1n+f KNew{} Tuple{xs, x}: PTA{PNew{U32.is_eq(ph_f2u(x), 1)}, xs, (off + 2 : U32)} case 1n++f KNode{} Tuple{xs, x}: pta_then(pt_read(f, pt_kind(ph_f2u(x)), (off + 1 : U32), Array.get(F32, xs, (off + 2 : U32))), ta => xs2 => +off2 => pta_node(ta, pt_next(off2, Array.get(F32, xs2, off2), kb => rb => pt_read(f, kb, off2, rb)))) case 1n+f KLeaf{} Tuple{xs, x}: +n = ph_f2u(x) ptl_m(n, (off + 2 : U32), words_in(U32.to_nat(ph_hw(n)), 0, (off + 2 : U32), Array.get(F32, xs, (off + 2 : U32)), ph_words(U32.to_nat(n)))) case 1n+f KLeafV{} Tuple{xs, x}: +n = ph_f2u(x) ptlv_m(n, (off + 2 : U32), words_in(U32.to_nat(ph_hw(n)), 0, (off + 2 : U32), Array.get(F32, xs, (off + 2 : U32)), ph_words(U32.to_nat(n)))) Uses (24): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=PK https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=PTA https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=PTree https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ph_f2u https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ph_hw https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ph_words https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pt_kind https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pt_next https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pta_node https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pta_then https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ptl_m https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ptlv_m https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=words_in