Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
88
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
140
Windows Automation - Howard Feldman
lvrug
0
79
Separating Your Application from Rails - Brian Hughes
lvrug
0
130
SWIG and Ruby - David Grayson
lvrug
0
85
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
140
The Hamster Gem - Ryan Mulligan
lvrug
1
100
Varnish+Redis - Russ Smith
lvrug
1
110
Making Good Use of Fonts - Russ Smith
lvrug
1
96
Writing Files - Ryan Mulligan
lvrug
0
72
Featured
See All Featured
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
31
Bash Introduction
62gerente
615
210k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.2k
So, you think you're a good person
axbom
PRO
0
1.8k
Practical Orchestrator
shlominoach
190
11k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
73
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Embracing the Ebb and Flow
colly
88
4.9k
Deep Space Network (abreviated)
tonyrice
0
21
Designing for Timeless Needs
cassininazir
0
93
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