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
Lambdas and Pops - Jan Hettich
Search
Las Vegas Ruby Group
June 18, 2014
130
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
190
Windows Automation - Howard Feldman
lvrug
0
130
Separating Your Application from Rails - Brian Hughes
lvrug
0
180
SWIG and Ruby - David Grayson
lvrug
0
120
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
160
The Hamster Gem - Ryan Mulligan
lvrug
1
150
Varnish+Redis - Russ Smith
lvrug
1
160
Making Good Use of Fonts - Russ Smith
lvrug
1
130
Writing Files - Ryan Mulligan
lvrug
0
120
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
490
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k
Writing Fast Ruby
sferik
630
63k
The Curse of the Amulet
leimatthew05
3
17k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Mind Mapping
helmedeiros
1
430
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k
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