JSON.batch_leaves: def of qasim-bend-kit@0.1.0.2 Import: import qasim-bend-kit@0.1.0.2/libs/JSON.bend as JSON Lines 1244-1252 of qasim-bend-kit@0.1.0.2/libs/JSON.bend: https://jend.leeeet.dev/read.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&start_line=1244&end_line=1252 import Base # Build a balanced fork tree from documents in source order. Pairing adjacent # trees on each pass keeps the depth logarithmic without copying input text. # For best lane balance, supply documents of similar lengths/complexity. def batch_leaves(texts: List<&2, String>) -> List<&2, Batch>: match texts: case Nil{}: Nil{} case text <> tail: Document{text} <> batch_leaves(tail) Uses (3): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=Batch