def temb_from
import mlbend-generative@0.1.1.0/main.bend as MlbendGenerativeimport Base
230# The embedding of step t over `steps`, from rung `p` on, `left` rungs —
231# each rung a sine and a cosine. The rungs left are the recursion; the
232# rung index rides after them.
233def temb_from(+t: Nat, +steps: Nat, +left: Nat, +p: Nat) -> List<&2, F32>:
234 match left:
235 case 0n:
236 Nil{}
237 case 1n+rest:
238 +tau = (F32.from_nat(t) / F32.from_nat(steps) : F32)
239 +f = freq_of(p)
240 Con{F32.sin((tau * f : F32)), Con{F32.cos((tau * f : F32)),
241 temb_from(t, steps, rest, (1n + p : Nat))}}