def tail
import bend-kit-hash@0.3.0.2/hash.bend as Hashimport Base
112# Folds f over the low k bytes of w, lowest first.
113def tail(~T: Type, ~f: T -> @+c: U32 -> T, k: Nat, +w: U32, acc: T) -> T:
114 match k:
115 case 0n:
116 acc
117 case 1n+p:
118 tail(~T, ~f, p, (w >> 8n : U32), f(acc, (w .&. 255 : U32)))