Skip to content

Instantly share code, notes, and snippets.

Last active January 1, 2016 16:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
void main() {
value employees = {"neal", "s", "stu", "j", "rich", "bob"};
String result = ",".join(employees
.filter((String e) => e.longerThan(1))
.map((String s) => s.segment(0, 1).uppercased + s.spanFrom(1))
// using a for comprehension
String result = ", ".join {
for (i in employees)
if (i.longerThan(1))
i.segment(0, 1).uppercased + i.spanFrom(1)
Copy link

Just stumbled upon this. A couple of suggestions:

  1. As of Ceylon 1.1, the explicit type annotations in the anonymous functions are no longer required.
  2. We usually write x.segment(0, 1) as x[0:1], and x.spanFrom(1) as x[1...].


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