Conversation

OlgaNovg

closes #672

}
ret := flatten(v)
size = uint(len(ret))
return ret, size, nil
Copy link
Member

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 {
Copy link
Member

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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@antonmedvantonmedv merged commit 5e660e7 into expr-lang:master Jul 15, 2024
12 checks passed
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Add flatten() builtin