Compare commits

..

No commits in common. "main" and "v0.10.0" have entirely different histories.

7 changed files with 1207 additions and 7 deletions

View file

@ -0,0 +1,13 @@
{
"permissions": {
"allow": [
"Bash(TestDropWhile\"\ngo test -bench=\"BenchmarkTakeWhile)",
"Bash(gh pr create:*)",
"Bash(TestTranspose)",
"Bash(TestUnzip)",
"Bash(TestParallelReduce)"
],
"deny": [],
"ask": []
}
}

1
.gitignore vendored
View file

@ -63,4 +63,3 @@ docs/public
.claude
AGENTS.md
bench*txt
ACTION_PLAN.md

1189
ACTION_PLAN.md Normal file

File diff suppressed because it is too large Load diff

View file

@ -80,7 +80,7 @@ func BenchmarkFirst(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = u.First(nums)
u.First(nums)
}
}

View file

@ -4,8 +4,7 @@ package underscore
// Also known as foldr in Haskell.
//
// Example: FoldRight([]int{1,2,3}, 0, func(n, acc int) int { return n - acc })
//
// → 1 - (2 - (3 - 0)) = 1 - (2 - 3) = 1 - (-1) = 2
// → 1 - (2 - (3 - 0)) = 1 - (2 - 3) = 1 - (-1) = 2
func FoldRight[T, P any](values []T, acc P, fn func(T, P) P) P {
for i := len(values) - 1; i >= 0; i-- {
acc = fn(values[i], acc)

View file

@ -53,7 +53,7 @@ func BenchmarkParallelMap(b *testing.B) {
b.Run(fmt.Sprintf("workers=%d", workers), func(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = u.ParallelMap(ctx, data, workers, func(_ context.Context, n int) (int, error) {
u.ParallelMap(ctx, data, workers, func(_ context.Context, n int) (int, error) {
return n * 2, nil
})
}
@ -76,7 +76,7 @@ func BenchmarkMapVsParallelMap(b *testing.B) {
b.Run("ParallelMap", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = u.ParallelMap(ctx, data, 0, func(_ context.Context, n int) (int, error) {
u.ParallelMap(ctx, data, 0, func(_ context.Context, n int) (int, error) {
return n * 2, nil
})
}

View file

@ -164,7 +164,7 @@ func BenchmarkParallelReduce(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = u.ParallelReduce(ctx, nums, 4, func(ctx context.Context, n int, acc int) (int, error) {
u.ParallelReduce(ctx, nums, 4, func(ctx context.Context, n int, acc int) (int, error) {
return n + acc, nil
}, 0)
}