def foldf

bend-toon-codec@0.1.0.0 · src/fold.bend:213

import bend-toon-codec@0.1.0.0/src/fold.bend as Fold
import Base
import bend-toon-codec@0.1.0.0/src/json.bend as J

213# `fs` is a field chain. `budget` is the segments still allowed, `prefix` the
214# dotted path of the object so far, `rl` the literal dotted keys at root.
215def foldf(+fuel: Nat, +fs: J.Json, +sibs: List<&2, String>, +budget: U32, +prefix: String, +rl: List<&2, String>) -> J.Json:
216  match fuel fs:
217    case 0n _:
218      fs
219    case 1n+p J.JField{k, v, t}:
220      +pl : Plan = plan(k, v, sibs, budget, prefix, rl)
221      field.mk(pl, foldf(p, plan.fs(pl), plan.sibs(pl), plan.nb(pl), plan.np(pl), rl), foldf(p, t, sibs, budget, prefix, rl))
222    case 1n+p _:
223      fs

Uses (12)

Used by (1)