Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Code examples from my ChicagoRuby talk on lamdas, blocks, Procs, and company.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore git ignore file
.hgignore
.hgtags Added tag 20100417glrb for changeset cf6b9cd6e895
README.md update readme
Rakefile abstract spec files
abstraction.rb replace proc with block
alias_brackets.rb more appropriate call for Cthulhu
arity.rb
asset_host.rb image names for asset host example
backtrace_cleaner_example.rb alternate method for filtering
bind_unbind.rb refactor bind/unbind for separate slides
block_capture.rb
block_return.rb tweak block return
block_yield.rb reworked examples
c_in_ruby.rb coding style counterexamples
class_proc.rb reformatting
closure.rb reworked examples
contain_exceptions.rb non-Proc exception example that uses ordinary yield
contain_exceptions_rspec.rb rename exception example to make way for new version
contain_values.rb typo
error_handling.rb reformatting
first_class_spec.rb reformat first class specs
identity_crisis.rb
iterators.rb first drafts; after adding proc-shortener
java_in_ruby.rb coding style counterexamples
lambda.rb
lambda1.9.rb
lambda_rack.rb update examples for 1.9 compatibility
method.rb expand method for multiple slides
monad_spec.rb a few comments; it will still eat your brain
non_local_return_lambda.rb rename return:: to non-local return
non_local_return_locations.rb
non_local_return_spec.rb rename return:: to non-local return
object_rack.rb update examples for 1.9 compatibility
passing_the_block.rb reworked examples
passing_the_proc.rb replace proc with block
proc_arguments.rb
proc_objects.rb
respond_to_example.rb simpler respond_to with method_missing
self.rb reworked examples
self_bogus_spec.rb self specs
self_spec.rb self specs
shared_scope.rb reformat shared scope
storage.rb
super_spec.rb first drafts; after adding proc-shortener
to_proc.rb replace proc with block
transmutation.rb first drafts; after adding proc-shortener
y_combinator_spec.rb just for fun - Y combinator in Ruby
you_already_use_closure.rb prosaic use of closure

README.md

Code examples for Justin Love's lambda/closure talks

  • "Lambdas, Procs and Blocks, Oh My", ChicagoRuby (Elmhurst) 2010-02-20
  • "Lambda and Closure: Horrors of the Computer Science Mythos", Great Lakes Ruby Bash, 2010-04-17

http://JustinLove.name/presentations/index.html

The first version of the talk had several examples that didn't make the cut, and with refactoring the greater part are longer used.

The examples were originally developed under 1.8.7; as of last check, they all run under 1.9.1. My environment is OS X using MacPorts; in particular, this environment installs 1.8 as 'ruby' and 1.9 as 'ruby1.9'.

Generating Output

run rake; it will create .txt files with interleaved input/output, using irb and rspec.

Something went wrong with that request. Please try again.