change signature of concatenate() to take an Iterable
See original GitHub issue[@jvasileff] Currently, there is an asymmetry in the signatures of expand
and concatenate
:
shared Element[] concatenate<Element>({Element*}* iterables)
shared Iterable<Element,OuterAbsent|InnerAbsent> expand<Element, OuterAbsent, InnerAbsent>
(Iterable<Iterable<Element,InnerAbsent>,OuterAbsent> iterables)
given OuterAbsent satisfies Null
given InnerAbsent satisfies Null {}
with, IMO, the non-variadic iterables
in expand
being better, providing the following benefits:
- In some cases, the production of a
nonempty
result - More convenient syntax for named argument invocations
I believe the second point is an important one, since when programming with apis such as ceylon.ast
and ceylon.html
, it is far more convenient to always use named argument lists, to avoid confusion between )
and }
in the middle of large expressions.
In the examples below, the first is superior:
printAll {
expand {
{"a", "b"},
{"c", "d"}
};
};
printAll {
concatenate(
{"a", "b"},
{"c", "d"}
);
};
printAll {
concatenate {
[
{"a", "b"},
{"c", "d"}
];
};
};
[Migrated from ceylon/ceylon.language#738]
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Overriding Iterator Signature - typescript - Stack Overflow
I want to create a wrapper on Array object to handle two dimensional arrays easier. Everything is fine but I also want to...
Read more >Python's map(): Processing Iterables Without a Loop
Python's map() is a built-in function that allows you to process and transform all the items in an iterable without using an explicit...
Read more >typing — Support for type hints — Python 3.11.1 documentation
Type aliases are useful for simplifying complex type signatures. ... 'item' could be any type, # and that type might have a 'bar'...
Read more >Strings should not be concatenated using '+' in a loop
Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your JAVA code · All rules 649 · Vulnerability54 · Bug154...
Read more >CONCATENATE function - Microsoft Support
Use CONCATENATE, one of the text functions, to join two or more text strings into one string. Important: In Excel 2016, Excel Mobile,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems this should be accepted or closed for the next release.
[@gavinking] No.
Sent from my iPhone