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 pr...
Search
Richard Dallaway
September 27, 2011
Technology
2
530
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
33
Voice to guide "difficult" recycling queries
d6y
0
48
Brighton Java: Day in the life...
d6y
0
190
Day in the Life of a Functional Programmer
d6y
0
580
Exoplanet Safari
d6y
1
400
Types Working For You
d6y
1
2.6k
Towards Browser and Server Utopia with Scala.js: an example using CRDTs
d6y
0
7.6k
Code Review Gems
d6y
1
1.9k
Woot for Lift
d6y
2
3.1k
Other Decks in Technology
See All in Technology
ABWGのRe:Cap!
hm5ug
1
120
20250116_JAWS_Osaka
takuyay0ne
2
190
SpiderPlus & Co. エンジニア向け会社紹介資料
spiderplus_cb
0
850
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
960
Evolving Architecture
rainerhahnekamp
3
250
シフトライトなテスト活動を適切に行うことで、無理な開発をせず、過剰にテストせず、顧客をビックリさせないプロダクトを作り上げているお話 #RSGT2025 / Shift Right
nihonbuson
3
2.1k
月間60万ユーザーを抱える 個人開発サービス「Walica」の 技術スタック変遷
miyachin
1
120
The future we create with our own MVV
matsukurou
0
2k
#TRG24 / David Cuartielles / Post Open Source
tarugoconf
0
560
テストを書かないためのテスト/ Tests for not writing tests
sinsoku
1
170
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
110
Visual StudioとかIDE関連小ネタ話
kosmosebi
1
370
Featured
See All Featured
Optimizing for Happiness
mojombo
376
70k
Code Review Best Practice
trishagee
65
17k
Building Adaptive Systems
keathley
38
2.4k
What's in a price? How to price your products and services
michaelherold
244
12k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
192
16k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Mobile First: as difficult as doing things right
swwweet
222
9k
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();