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
Lambdas and Pops - Jan Hettich
Search
Las Vegas Ruby Group
June 18, 2014
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Lambdas and Pops - Jan Hettich
Las Vegas Ruby Group
June 18, 2014
More Decks by Las Vegas Ruby Group
See All by Las Vegas Ruby Group
Ruby ISO Standard - David Grayson
lvrug
0
170
Windows Automation - Howard Feldman
lvrug
0
110
Separating Your Application from Rails - Brian Hughes
lvrug
0
160
SWIG and Ruby - David Grayson
lvrug
0
100
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
150
The Hamster Gem - Ryan Mulligan
lvrug
1
120
Varnish+Redis - Russ Smith
lvrug
1
140
Making Good Use of Fonts - Russ Smith
lvrug
1
120
Writing Files - Ryan Mulligan
lvrug
0
95
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
190
My Coaching Mixtape
mlcsv
0
140
Are puppies a ranking factor?
jonoalderson
1
3.5k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
200
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
390
The browser strikes back
jonoalderson
0
1.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Amusing Abliteration
ianozsvald
1
200
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Transcript
λ's and POP's Jan Hettich LVRUG 5/21/2014
Two kinds of Proc “plain old proc” lambda closure? yes
yes class Proc Proc .lambda? false true semantics yield invocation similar to block method
Creation • “Plain old procs” • Kernel.proc {|args| code} •
Proc.new {|args| code} • Lambdas • Kernel.lambda {|args| code} • literal: ->(args) {code} • Method.to_proc
call syntax • direct call – foo.call(args) – foo[args] –
foo.(args) • block-style call – iterator args, &foo
call semantics • yield semantics (blocks, pops) • similar to
parallel assignment • return => lexically enclosing method • invocation semantics (methods, lambdas) • number of arguments must match • “diminutive return”
Let's look at some code • A Digression on Method
• Argument Passing • return statement • Using next • New behavior in Ruby 2.1.0