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
Fun Ruby
Search
Guilherme Carlos
July 03, 2015
Technology
0
95
Fun Ruby
Functional Programming concepts in Ruby
Guilherme Carlos
July 03, 2015
Tweet
Share
More Decks by Guilherme Carlos
See All by Guilherme Carlos
What's new in Rails 5?
gtcarlos
0
85
Other Decks in Technology
See All in Technology
オーナーシップを持つ領域を明確にする
konifar
8
1.2k
TransitGatewayの基礎
toru_kubota
0
230
巨大なテーブルのテーブル定義を無停止で安全に誰でも変更できるようにする / Table-definitions-for-huge-tables-can-be-modified-by-anyone-safely-and-non-disruptively
freee
1
720
"好き"との生活/Regularly update profile with GitHub Actions
judeeeee
0
150
スタートアップの技術顧問を3年間続けて発生した事と気付き
biwakonbu
0
150
SREとその組織類型
tatsuo48
8
1.5k
Hands-on / Kaname Frusawa / Cloud Compare Users Meetup 2024 at University of Tokyo on April 17
paraworld
2
470
Postman v10リリース後を振り返る
nagix
0
120
[2024年3月版] Databricksのシステムアーキテクチャ
databricksjapan
7
1.9k
反実仮想機械学習とは何か
usaito
PRO
6
1.6k
普段有償でサポート業務をしているCSAが技術知見を無料で公開する理由
07jp27
1
630
プロトタイピングによる不確実性の低減 / Reducing Uncertainty through Prototyping
ohbarye
3
180
Featured
See All Featured
Building Effective Engineering Teams - LeadDev
addyosmani
26
1.8k
Six Lessons from altMBA
skipperchong
19
3k
Infographics Made Easy
chrislema
237
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
How to name files
jennybc
64
92k
10 Git Anti Patterns You Should be Aware of
lemiorhan
645
57k
Product Roadmaps are Hard
iamctodd
43
9.7k
We Have a Design System, Now What?
morganepeng
42
6.7k
Fireside Chat
paigeccino
19
2.6k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
103
6.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
24
2.3k
Principles of Awesome APIs and How to Build Them.
keavy
119
16k
Transcript
Fun Ruby Functional Programming concepts in Ruby
Who? Guilherme Carlos 23 Computer Information Systems PUC Campinas @gtcarlos_
gtcarlos
Functional Programming?
None
None
Lambda Calculus 1930s Alonzo Church (Princeton) Lambda Currying Immutability Pure
Functions
LISP 1959 John McCarthy (MIT) Lambda Calculus applied Symbols Garbage
Collector
FP in a Nutshell ➔ Anonymous Functions ➔ Higher Order
Functions ➔ Immutability ➔ No Side-Effects
Ruby is not a functional language! but have some functional
traits
Anonymous Function
Closures
None
➔ Anonymous Functions (Lambda) ➔ Higher Order Functions ➔ Immutability
➔ No Side-Effects
➔ Accept a function as an argument ➔ Return a
function as the return value Higher Order Function
Blocks everywhere!
Enumerable
➔ Anonymous Functions (Lambda) ➔ Higher Order Functions ➔ Immutability
➔ No Side-Effects
Immutability “Much of Ruby, especially its runtime, is much closer
to Python's [than Perl's], with the exception of Ruby's mutable strings, which I find an abomination.” - Guido van Rossum (Python creator)
None
None
None
Bang!
➔ Anonymous Functions (Lambda) ➔ Higher Order Functions ➔ Immutability
➔ No Side-Effects
Pure Functions ➔ The function always evaluates the same result
value given the same argument value ➔ Evaluation of the result does not cause any semantically observable side effect or output
None
None
➔ Anonymous Functions (Lambda) ➔ Higher Order Functions ➔ Immutability
➔ No Side-Effects
Advantages of FP ➔ Best readability ➔ Modularity ➔ Concurrency
➔ Testability
Disadvantages of FP ➔ Not suited to every problem ➔
Academic stuff
Rolling in the Deep Elixir Clojure Scala
Questions?