-
-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add flatten function #684
add flatten function #684
Conversation
} | ||
ret := flatten(v) | ||
size = uint(len(ret)) | ||
return ret, size, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! As flatten creates a new array it makes sense to safe from uncontrolled grow.
@@ -359,3 +359,17 @@ func median(args ...any) ([]float64, error) { | |||
} | |||
return values, nil | |||
} | |||
|
|||
func flatten(arg reflect.Value) []any { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! No need to extra .Interface() call. 👍🏻
@@ -689,6 +689,14 @@ Concatenates two or more arrays. | |||
concat([1, 2], [3, 4]) == [1, 2, 3, 4] | |||
``` | |||
|
|||
### flatten(array) {#flatten} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
closes #672