Skip to content

Instantly share code, notes, and snippets.

@quintesse
Created May 5, 2016 09:56
Show Gist options
  • Save quintesse/90f94237737eacd357e83062af47ef4f to your computer and use it in GitHub Desktop.
Save quintesse/90f94237737eacd357e83062af47ef4f to your computer and use it in GitHub Desktop.
Ceylon Web Runner: flatten
//$webrun_wrapped
shared void run() {
{Anything*} flatten({Anything*} stream)
=> stream.flatMap((element)
=> switch (element)
case (is {Anything*}) flatten(element)
else [element]);
{Character|String*} input = { 'a', "abc" };
print(flatten(input));
}
@quintesse
Copy link
Author

Click here to run this code online

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment