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
95
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
150
Windows Automation - Howard Feldman
lvrug
0
94
Separating Your Application from Rails - Brian Hughes
lvrug
0
150
SWIG and Ruby - David Grayson
lvrug
0
92
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
140
The Hamster Gem - Ryan Mulligan
lvrug
1
110
Varnish+Redis - Russ Smith
lvrug
1
120
Making Good Use of Fonts - Russ Smith
lvrug
1
100
Writing Files - Ryan Mulligan
lvrug
0
79
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
590
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Why Our Code Smells
bkeepers
PRO
340
58k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
340
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.8k
How GitHub (no longer) Works
holman
316
140k
How to Ace a Technical Interview
jacobian
281
24k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
870
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
230
Documentation Writing (for coders)
carmenintech
77
5.3k
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