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
180
Windows Automation - Howard Feldman
lvrug
0
120
Separating Your Application from Rails - Brian Hughes
lvrug
0
170
SWIG and Ruby - David Grayson
lvrug
0
110
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
160
The Hamster Gem - Ryan Mulligan
lvrug
1
140
Varnish+Redis - Russ Smith
lvrug
1
150
Making Good Use of Fonts - Russ Smith
lvrug
1
120
Writing Files - Ryan Mulligan
lvrug
0
110
Featured
See All Featured
Amusing Abliteration
ianozsvald
1
290
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Building Adaptive Systems
keathley
44
3.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The World Runs on Bad Software
bkeepers
PRO
72
12k
sira's awesome portfolio website redesign presentation
elsirapls
0
410
The untapped power of vector embeddings
frankvandijk
2
1.9k
A Soul's Torment
seathinner
7
3.6k
Docker and Python
trallard
47
4.2k
Automating Front-end Workflow
addyosmani
1369
210k
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