def batch_leaves

qasim-bend-kit@0.1.0.2 · libs/JSON.bend:1244

import qasim-bend-kit@0.1.0.2/libs/JSON.bend as JSON
import Base

1244# Build a balanced fork tree from documents in source order. Pairing adjacent
1245# trees on each pass keeps the depth logarithmic without copying input text.
1246# For best lane balance, supply documents of similar lengths/complexity.
1247def batch_leaves(texts: List<&2, String>) -> List<&2, Batch>:
1248    match texts:
1249        case Nil{}:
1250            Nil{}
1251        case text <> tail:
1252            Document{text} <> batch_leaves(tail)

Uses (3)

Used by (1)