Skip to content

Commit

Permalink
[HOTFIX] Improve gofp.Map usage. (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skandalik authored Jun 7, 2023
1 parent d8f3a91 commit 986edc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: go version

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
run: go install honnef.co/go/tools/cmd/staticcheck@2022.1

- name: Install cover
run: go get -u golang.org/x/tools/cmd/cover
Expand Down
3 changes: 2 additions & 1 deletion gofp/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package gofp

// Map apply a function to all elements on an array
func Map[T, V any](list []T, fn func(T) V) (res []V) {
res = make([]V, len(list))
for i := range list {
res = append(res, fn(list[i]))
res[i] = fn(list[i])
}

return
Expand Down

0 comments on commit 986edc2

Please sign in to comment.