Catamorphism: Difference between revisions

m
→‎{{header|Zig}}: fix comment in code
m (→‎{{header|RPL}}: formatted code, comment on STREAM function)
m (→‎{{header|Zig}}: fix comment in code)
Line 2,980:
 
===Reduce a slice===
<syntaxhighlight lang="zig">/// Asserts that `elemarray`.len >= 1.
pub fn reduce(comptime T: type, comptime applyFn: fn (T, T) T, array: []const T) T {
var val: T = array[0];
28

edits