reducta-pro
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
Syntax:
Category#
collection
Related#
None.
Examples#
radix/corpus/summa/reducta-pro.fab (canonical · concept)#
fn per_alveum(tf32[6] altitudo, tensor<int, [6]> alveus) → tf32[3] {
return reduce via sum from altitudo at [i] step alveus[i] let s {
return s
}
}
fn numera_alveum(tf32[6] altitudo, tensor<int, [6]> alveus) → tensor<int, [3]> {
return reduce via count from altitudo at [i] step alveus[i] let s {
return s ≻ 2.5
}
}
main {
let list<f32> flat ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
let tf32[6] altitudo ← flat ↦ tensor<f32, [6]>
let tensor<int, [6]> aequalis ← [0, 1, 2, 0, 1, 2] ↦ tensor<int, [6]>
let tensor<int, [6]> inaequalis ← [0, 0, 1, 1, 0, 1] ↦ tensor<int, [6]>
print per_alveum(altitudo, aequalis)
print per_alveum(altitudo, inaequalis)
print numera_alveum(altitudo, aequalis)
print numera_alveum(altitudo, inaequalis)
}Expected output:
[5.0, 7.0, 9.0]
[8.0, 13.0, 0.0]
[1, 1, 2]
[1, 3, 0]