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

String concenatation #185

Closed
annevk opened this issue Jan 4, 2018 · 1 comment
Closed

String concenatation #185

annevk opened this issue Jan 4, 2018 · 1 comment

Comments

@annevk
Copy link
Member

annevk commented Jan 4, 2018

How about:

To string concatenate a list list with an optional separator separator, run these steps:

  1. If list is empty, then return the empty string.
  2. Assert: list only contains strings.
  3. If separator is not given, then set separator to the empty string.
  4. Assert: separator is a string.
  5. Return a string whose contents are list's items, in order, separated from each other by separator.

Needed for whatwg/dom#555 and HTML; possibly other places. (URL concatenates bytes as well, but we don't have generics so...)

cc @Ms2ger

@domenic
Copy link
Member

domenic commented Jan 4, 2018

I'd minorly prefer "a list of strings list with an optional separator string separator" then remove the asserts.

I think you could also just define it as "concatenate" with for=string or similar.

annevk added a commit that referenced this issue Jan 4, 2018
annevk added a commit that referenced this issue Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants