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
プロデザ! BY リクルート vol.18_リクルートのリサーチ実践組織「リサーチブーストコミュニティ」
recruitengineers
PRO
3
280
20240416_devopsdaystokyo
kzkmaeda
1
220
エンジニア候補者向け資料2024.04.24.pdf
macloud
0
3.3k
生産性向上チームの紹介
cybozuinsideout
PRO
1
870
継続的な改善 x ⾮連続的な進化
sansantech
PRO
3
150
「スニダン」開発組織の構造に込めた意図 ~組織作りはパッションや政治ではない!~
rinchsan
3
550
非同期推論システムによるコスト削減と信頼性向上
koki_nishihara
0
220
NgRx Signal Store
rainerhahnekamp
0
150
プラットフォームってつくることより計測することが重要なんじゃないかという話 / Platform Engineering Meetup #8
taishin
1
350
Python と Snowflake はズッ友だょ!~ Snowflake の Python 関連機能をふりかえる ~
__allllllllez__
1
110
TechFeed Experts Night#27 〜 フロントエンドフレームワーク最前線 (Svelte)
baseballyama
1
410
VS CodeでAWSを操作しよう
smt7174
7
1.6k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
KATA
mclloyd
15
12k
Building an army of robots
kneath
300
41k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Art, The Web, and Tiny UX
lynnandtonic
289
19k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Design by the Numbers
sachag
274
18k
Become a Pro
speakerdeck
PRO
11
4.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
9
8.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
14
1.6k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
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();