More Related Content
Similar to What functional programming means to me (20)
What functional programming means to me
- 2. What have we have? What do we want?
happy birthday to
happy birthday to me
me #lol #omg
oops #lol oops #lol #omg
⋮ ⋮
- 3. What have we have? What do we want?
#lol, #omg
Some text
& some text
- 4. What have we have? What do we want?
#lol, #omg
Some text
& some text
List[String], String String
- 5. def appendTags(tweet: String, tags: List[String]) =
tags.foldLeft(tweet) { appendOne }
def appendOne(tweet: String, tag: String) =
if (tweet contains tag) tweet else tweet+" "+tag
- 6. StringBuffer b = new StringBuffer(tweet);
if (tags != null) {
for(String tag: tags) {
if (tag != null && b.indexOf(tag) == -1) {
b.append(tag).append(“ ”);
}
}
}
return b.toString();
- 12. for { entry ← resultFeed.getEntries
name ← Option(entry.getName)
full_name ← Option(name.getFullName)
birthday ← Option(entry.getBirthday)
} yield "%s: %s".format(full_name.getValue, when)