Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
今からでも間に合う!速習Devin入門とその活用方法
ismk
1
750
Challenging Hardware Contests with Zephyr and Lessons Learned
iotengineer22
0
230
Reinforcement Fine-tuning 基礎〜実践まで
ch6noota
0
190
生成AI活用の型ハンズオン〜顧客課題起点で設計する7つのステップ
yushin_n
0
230
文字列の並び順 / Unicode Collation
tmtms
3
600
re:Inventで気になったサービスを10分でいけるところまでお話しします
yama3133
1
120
多様なデジタルアイデンティティを攻撃からどうやって守るのか / 20251212
ayokura
0
470
コミューンのデータ分析AIエージェント「Community Sage」の紹介
fufufukakaka
0
510
AI 駆動開発勉強会 フロントエンド支部 #1 w/あずもば
1ftseabass
PRO
0
400
MLflowダイエット大作戦
lycorptech_jp
PRO
1
140
業務のトイルをバスターせよ 〜AI時代の生存戦略〜
staka121
PRO
2
210
Fashion×AI「似合う」を届けるためのWEARのAI戦略
zozotech
PRO
2
810
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
Side Projects
sachag
455
43k
Speed Design
sergeychernyshev
33
1.4k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Music & Morning Musume
bryan
46
7k
GraphQLとの向き合い方2022年版
quramy
50
14k
Designing for humans not robots
tammielis
254
26k
Fireside Chat
paigeccino
41
3.7k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.3k
What's in a price? How to price your products and services
michaelherold
246
13k
The Pragmatic Product Professional
lauravandoore
37
7.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();