Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Functional Brighton Meet up: what functional programming means to me.
Richard Dallaway
September 27, 2011
Technology
2
320
Functional Brighton Meet up: what functional programming means to me.
See:
http://richard.dallaway.com/functional-brighton-presentations-on-what-fun
Richard Dallaway
September 27, 2011
Tweet
Share
More Decks by Richard Dallaway
See All by Richard Dallaway
AI Roadmap
d6y
0
20
Voice to guide "difficult" recycling queries
d6y
0
27
Brighton Java: Day in the life...
d6y
0
75
Day in the Life of a Functional Programmer
d6y
0
400
Exoplanet Safari
d6y
1
250
Types Working For You
d6y
1
2.4k
Towards Browser and Server Utopia with Scala.js: an example using CRDTs
d6y
0
6.5k
Code Review Gems
d6y
1
1.7k
Woot for Lift
d6y
2
2.9k
Other Decks in Technology
See All in Technology
QiitaConference2022
fuwasegu
0
160
データをモデリングしていたら、組織をモデリングし始めた話 / engineers-in-carta-vol3-data-engineer
pei0804
4
3.3k
The role of the data organization as a business progresses
line_developers
PRO
3
840
20220622_FinJAWS_あのときにAWSがあったらこうできた
taketakekaho
0
110
モブに早く慣れたい人のためのガイド / A Guide to Getting Started Quickly with Mob Programming
cybozuinsideout
PRO
2
1.7k
要約 "Add Live Text interaction to your app"
ushisantoasobu
0
140
リファインメントは楽しいかね?
kitamu_mu
1
380
History of the ML system in KARTE
kargo113
0
610
セキュリティ 開運研修2022 / security 2022
cybozuinsideout
PRO
3
3.6k
JJUG2022_spring_Keycloak (Red Hat Single Sign-on)
tinoue
0
200
Scrum Fest Osaka 2022 フルリモート下でのチームビルディング
moritamasami
2
1.1k
サイボウズの アジャイル・クオリティ / Agile Quality at Cybozu
cybozuinsideout
PRO
4
2.2k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
212
20k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
No one is an island. Learnings from fostering a developers community.
thoeni
9
1.3k
Building Flexible Design Systems
yeseniaperezcruz
310
34k
Designing on Purpose - Digital PM Summit 2013
jponch
106
5.6k
What’s in a name? Adding method to the madness
productmarketing
11
1.6k
The Brand Is Dead. Long Live the Brand.
mthomps
46
2.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
A better future with KSS
kneath
225
15k
The World Runs on Bad Software
bkeepers
PRO
57
5.3k
The Illustrated Children's Guide to Kubernetes
chrisshort
15
36k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
655
120k
Transcript
Three things I’ve noticed about functional programming while using Scala.
happy birthday to me happy birthday to me #lol #omg
oops #lol oops #lol #omg 㱺 㱺 ⋮ ⋮ What have we have? What do we want?
#lol, #omg & some text Some text 㱺 What have
we have? What do we want?
#lol, #omg & some text Some text 㱺 What have
we have? What do we want? List[String], String 㱺 String
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
“It’s the mutable state, stupid.” – Göetz et al.
val results = List(yahoo _, google _).par.map(_.apply)
import scala.actors.Futures._ val results = List(yahoo _, google _) map
( f 㱺 future{ f() } ) map (_.apply)
Option, for comprehensions, flatMap & pattern matching are astonishingly useful
every day and I’d never heard of them before learning Scala.
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
ContactEntry entry = resultFeed.getEntries().get(i); if (entry.hasName()) { Name name = entry.getName(); if (name.hasFullName()) { ...
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)
1. Thinking in terms of A 㱺 B 2. Concurrency
3. Option (& friends) change everything Summary
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();