Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Functional Brighton Meet up: what functional programming means to me.
Search
Richard Dallaway
September 27, 2011
Technology
2
480
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
27
Voice to guide "difficult" recycling queries
d6y
0
34
Brighton Java: Day in the life...
d6y
0
140
Day in the Life of a Functional Programmer
d6y
0
510
Exoplanet Safari
d6y
1
340
Types Working For You
d6y
1
2.5k
Towards Browser and Server Utopia with Scala.js: an example using CRDTs
d6y
0
7.1k
Code Review Gems
d6y
1
1.8k
Woot for Lift
d6y
2
3k
Other Decks in Technology
See All in Technology
GrafanaMeetup_AmazonManagedGrafanaのアクセス制御機能とマルチテナント環境下でのアクセス制御について
daitak
0
390
Babylon.jsと色々なものを組み合わせる:ブラウザのAPIやガジェットや2D描画ライブラリなど / Babylon.js 勉強会 vol.3
you
PRO
0
160
Building a RAG-poweredAI chat appwith Python and VS Code
pamelafox
0
150
Android Target SDK 35 (Android 15) 対応の概要
akkie76
0
150
The AI Revolution Will Not Be Monopolized: Behind the scenes
inesmontani
PRO
1
160
【基本】データベース設計
oracle4engineer
PRO
2
160
Rustで「プリズモイダル法」を利用して「土量計算」をガチでやる
nokonoko1203
1
280
EMとして2023年度に頑張ったこと / What we did well in FY2023 as a EM
pauli
1
210
データベース02: データベースの概念
trycycle
0
180
KubeConにproposalを送りたい人へのアドバイス
sat
PRO
3
270
web-application-security
matsuihidetoshi
1
190
ルーターでプレゼンする
puhitaku
1
3.2k
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
32
46k
Building Adaptive Systems
keathley
32
1.9k
How to name files
jennybc
65
93k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Statistics for Hackers
jakevdp
790
220k
Designing on Purpose - Digital PM Summit 2013
jponch
111
6.5k
How STYLIGHT went responsive
nonsquared
92
4.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Faster Mobile Websites
deanohume
300
30k
Automating Front-end Workflow
addyosmani
1357
200k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
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();