Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Functional Brighton Meet up: what functional pr...
Search
Richard Dallaway
September 27, 2011
Technology
590
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
Transcript
13 slides
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();
More Decks by Richard Dallaway
See All by Richard Dallaway
AI Roadmap
d6y
0
92
Voice to guide "difficult" recycling queries
d6y
0
100
Brighton Java: Day in the life...
d6y
0
270
Day in the Life of a Functional Programmer
d6y
0
680
Exoplanet Safari
d6y
1
520
Types Working For You
d6y
1
2.8k
Towards Browser and Server Utopia with Scala.js: an example using CRDTs
d6y
0
7.9k
Code Review Gems
d6y
1
2.1k
Woot for Lift
d6y
2
3.5k
Other Decks in Technology
See All in Technology
3文字略語に騙されない! 世界一わかりやすい『EDR』超入門
kamadamakoto
1
280
Biohub - Cell Tracking During Development 5th place solution
rist
0
180
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
380
これからのデータエンジニアの役割について考える / Rethinking the Role of Data Engineers in the AI Era
okiyuki99
1
540
HTTP通信に使おうとすると実はめんどくさいfile_get_contents
maguroalternative
0
230
こんなに変わった! AWSネットワークの常識
shotashiratori
16
11k
AIネイティブ組織の作り方。1人のPOとAIから始める、自社での実験
ama_ch
2
1.2k
Context parameters で作る!はじめての型クラス
kworkdev
PRO
1
160
メルカリの小規模チーム「Pod」で、 エンジニアがデータアナリストなしで、 AIを使ってデータ分析の自走を目指す取り組み
jackojacko_
0
250
LLM 基盤と kagent v0 を全部 k8s に入れてみた / Deploy both LLM and kagent v0 in k8s
kota2and3kan
0
240
農家は秘伝のタレを知らない - NOBODY KNOWS THE HIDDEN SOURCE - Kaggriculture 3rd Place Solution
masspeaks
3
550
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
190
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Navigating Weather and Climate Data
rabernat
0
590
From π to Pie charts
rasagy
1
450
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
640
Marketing to machines
jonoalderson
1
6k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
820
Design in an AI World
tapps
1
390
Thoughts on Productivity
jonyablonski
76
5.5k
The Language of Interfaces
destraynor
162
27k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
The World Runs on Bad Software
bkeepers
PRO
72
12k