aboutsummaryrefslogtreecommitdiff
path: root/src/fold.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/fold.zig')
-rw-r--r--src/fold.zig6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/fold.zig b/src/fold.zig
index 6b910d3..ddaf0a9 100644
--- a/src/fold.zig
+++ b/src/fold.zig
@@ -2,12 +2,11 @@ const std = @import("std");
const typeVerify = @import("util.zig").typeVerify;
/// ```zig
-/// (fn (fn (fn (b, a) b, b, []a) void)
+/// (fn (fn (fn (b, a) b, b, []a) b)
/// ```
/// Folds a list of items over a function with the accumulator as the first arg
/// Type signature: `(b -> a -> b) -> b -> [a] -> b`
/// `func` is of type `b -> a -> b`, where `items` is of type `[a]` and `accumulator` is of type `b`.
-/// Haskell equivalent: `foldl func accumulator items`
pub fn foldl(
comptime func: anytype,
accumulator: (typeVerify(@TypeOf(func), .{ .@"fn" }).@"fn".params[0].type.?),
@@ -20,12 +19,11 @@ pub fn foldl(
}
/// ```zig
-/// (fn (fn (fn (a, b) b, b, []a) void)
+/// (fn (fn (fn (a, b) b, b, []a) b)
/// ```
/// Folds a list of items over a function with the accumulator as the second arg
/// Type signature: `(a -> b -> b) -> b -> [a] -> b`
/// `func` is of type `a -> b -> b`, where `items` is of type `[a]` and `accumulator` is of type `b`.
-/// Haskell equivalent: `foldr func accumulator items`
pub fn foldr(
comptime func: anytype,
accumulator: (typeVerify(@TypeOf(func), .{ .@"fn" }).@"fn".params[1].type.?),