question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:

  1. In some cases, the production of a nonempty result
  2. 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:open
  • Created 8 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jvasileffcommented, Aug 26, 2017

Seems this should be accepted or closed for the next release.

0reactions
CeylonMigrationBotcommented, Nov 14, 2015

[@gavinking] No.

Sent from my iPhone

On 21 Sep 2015, at 17:05, Stéphane Épardaud notifications@github.com wrote:

Is that really for 1.2?

— Reply to this email directly or view it on GitHub.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found