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
0
77
Lambdas and Pops - Jan Hettich
Las Vegas Ruby Group
June 18, 2014
Tweet
Share
More Decks by Las Vegas Ruby Group
See All by Las Vegas Ruby Group
Ruby ISO Standard - David Grayson
lvrug
0
130
Windows Automation - Howard Feldman
lvrug
0
68
Separating Your Application from Rails - Brian Hughes
lvrug
0
120
SWIG and Ruby - David Grayson
lvrug
0
75
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
130
The Hamster Gem - Ryan Mulligan
lvrug
1
89
Varnish+Redis - Russ Smith
lvrug
1
100
Making Good Use of Fonts - Russ Smith
lvrug
1
86
Writing Files - Ryan Mulligan
lvrug
0
61
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
4.8k
Typedesign – Prime Four
hannesfritz
42
2.8k
Making Projects Easy
brettharned
119
6.4k
A better future with KSS
kneath
239
17k
For a Future-Friendly Web
brad_frost
180
9.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
114
20k
Context Engineering - Making Every Token Count
addyosmani
5
190
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
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