$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Functional Brighton Meet up: what functional pr...
Search
Richard Dallaway
September 27, 2011
Technology
2
550
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
46
Voice to guide "difficult" recycling queries
d6y
0
60
Brighton Java: Day in the life...
d6y
0
230
Day in the Life of a Functional Programmer
d6y
0
630
Exoplanet Safari
d6y
1
450
Types Working For You
d6y
1
2.7k
Towards Browser and Server Utopia with Scala.js: an example using CRDTs
d6y
0
7.7k
Code Review Gems
d6y
1
2k
Woot for Lift
d6y
2
3.3k
Other Decks in Technology
See All in Technology
CARTAのAI CoE が挑む「事業を進化させる AI エンジニアリング」 / carta ai coe evolution business ai engineering
carta_engineering
0
1.9k
AIプラットフォームにおけるMLflowの利用について
lycorptech_jp
PRO
1
170
生成AI時代におけるグローバル戦略思考
taka_aki
0
200
AWS re:Invent 2025で見たGrafana最新機能の紹介
hamadakoji
0
420
ChatGPTで論⽂は読めるのか
spatial_ai_network
11
29k
大企業でもできる!ボトムアップで拡大させるプラットフォームの作り方
findy_eventslides
1
830
プロンプトやエージェントを自動的に作る方法
shibuiwilliam
13
11k
今年のデータ・ML系アップデートと気になるアプデのご紹介
nayuts
1
490
業務のトイルをバスターせよ 〜AI時代の生存戦略〜
staka121
PRO
2
220
AlmaLinux + KVM + Cockpit で始めるお手軽仮想化基盤 ~ 開発環境などでの利用を想定して ~
koedoyoshida
0
110
Microsoft Agent 365 についてゆっくりじっくり理解する!
skmkzyk
0
380
Kiro を用いたペアプロのススメ
taikis
1
180
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.4k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Visualization
eitanlees
150
16k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Fireside Chat
paigeccino
41
3.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
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();