Skip to content

Conversation

OlgaNovg
Copy link
Contributor

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.

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. 👍🏻

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.

🔥

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add flatten() builtin

2 participants