diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2025-10-28 20:02:47 -0500 |
|---|---|---|
| committer | Nic Gaffney <gaffney_nic@protonmail.com> | 2025-10-28 20:02:47 -0500 |
| commit | 99c32737fe07bf7dc6094a1326be418ffd00e36f (patch) | |
| tree | bc8549038f85586ef4b9724f51ab850193f36d68 /src/fold.zig | |
| parent | 96e8c19ebdc7c168a1bd243ce1793b2df1480939 (diff) | |
| download | funcz-99c32737fe07bf7dc6094a1326be418ffd00e36f.tar.gz | |
filter implemented
Diffstat (limited to 'src/fold.zig')
| -rw-r--r-- | src/fold.zig | 6 |
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.?), |
