Skip to content
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

[Expression]Enable list concatenation for function "concat" #4066

Merged
merged 2 commits into from
Jun 17, 2020

Conversation

Danieladu
Copy link
Collaborator

@Danieladu Danieladu commented Jun 15, 2020

concat:

  1. If all items are lists, concatenate them with list mode.
    concat([1, 2], [3, 4]) -> [1, 2, 3, 4]

  2. If there exists any item that is not a list, use string concatenation mode:
    concat('a', 'b', 1, 2) -> 'ab12'
    concat('a', [1, 2]) -> aSystem.Collections.Generic.List 1[System.Object] // unreadable, best to avoid

  3. If null exists, skip it
    concat([1, 2], null) -> [1, 2]
    concat('a', 1, null) -> 'a1'

issue link: #4014

}
else
{
return $"{firstItem?.ToString()}{secondItem?.ToString()}";
Copy link
Contributor

@chrimc62 chrimc62 Jun 16, 2020

Choose a reason for hiding this comment

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

return $"{firstItem?.ToString()}{secondItem?.ToString()}"; [](start = 32, length = 58)

This will be much less efficient on large arrays than the previous implementation since it does not use a string builder. Why not extend ApplySequence to use an accumulator which can use a string builder?

Copy link
Contributor

@chrimc62 chrimc62 left a comment

Choose a reason for hiding this comment

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

🕐

Copy link
Contributor

@chrimc62 chrimc62 left a comment

Choose a reason for hiding this comment

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

:shipit:

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.

3 participants