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
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
42
Voice to guide "difficult" recycling queries
d6y
0
56
Brighton Java: Day in the life...
d6y
0
220
Day in the Life of a Functional Programmer
d6y
0
620
Exoplanet Safari
d6y
1
440
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
1.9k
Woot for Lift
d6y
2
3.2k
Other Decks in Technology
See All in Technology
OCI Network Firewall 概要
oracle4engineer
PRO
2
7.9k
サイバーエージェント流クラウドコスト削減施策「みんなで金塊堀太郎」
kurochan
3
1.8k
このままAIが発展するだけでAGI達成可能な理由
frievea
0
100
Data Hubグループ 紹介資料
sansan33
PRO
0
2.2k
ガバメントクラウドの概要と自治体事例(名古屋市)
techniczna
3
240
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
20k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.2k
incident_commander_demaecan__1_.pdf
demaecan
0
140
Adminaで実現するISMS/SOC2運用の効率化 〜 アカウント管理編 〜
shonansurvivors
4
450
「れきちず」のこれまでとこれから - 誰にでもわかりやすい歴史地図を目指して / FOSS4G 2025 Japan
hjmkth
1
310
Simplifying Cloud Native app testing across environments with Dapr and Microcks
salaboy
0
160
いまからでも遅くない!SSL/TLS証明書超入門(It's not too late to start! SSL/TLS Certificates: The Absolute Beginner's Guide)
norimuraz
0
240
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
Designing for humans not robots
tammielis
254
26k
Docker and Python
trallard
46
3.6k
Navigating Team Friction
lara
190
15k
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
Gamification - CAS2011
davidbonilla
81
5.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
35
6.1k
A Tale of Four Properties
chriscoyier
161
23k
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();