def pw
import bendtorch@1.3.0.0/main.bend as Bendtorchimport Base
2394# xs scaled by sc, written into p from idx on; n counts the numbers written (from the n given)
2395def pw(xs: List<&2, F32>, +idx: U32, +sc: F32, n: Nat, p: Array<F32>) -> PW:
2396 match xs:
2397 case Nil{}:
2398 PW{p, n}
2399 case Con{x, t}:
2400 pw(t, (idx + 1 : U32), sc, 1n+n, Array.set(F32, p, idx, (x * sc : F32)))