def scalar_result
import stelliferous@0.0.2.0/tensor.bend as Tensorimport Base
497# A reduction as a rank-0 tensor, so a failure propagates like any result.
498def scalar_result(~Element: Data,+fill: Element,+count: U32,result: Result<&2,&2,Problem,Element>) -> Tensor<Element>:
499 match result:
500 case Done{value}: with_workers(~Element,full(~Element,[],value),count)
501 case Fail{problem}: Tensor{buffer(~Element,fill,0),[],fill,Failed{problem},count}