~/talk

Each: A Brief History of Iteration

Talkat RubyConf 2010 · 2010-11-11..11-13· [ruby]
slides:none on file

A grounded tour of iteration history and concrete code shows how to implement linked list each implementation that yields elements and hence enables Enumerable to_a/collect/detect/select (each returns self); builds a Fibonacci using Enumerator and Enumerator::Yielder so the enumerator is an infinite sequence you can call next or take; benchmarks demonstrate collect + compact beats an inject-based comprehension; and practical examples of defining hash and eql for hash keys plus inspect and coercions make custom collections behave correctly in Ruby’s ecosystem.

AI-written summary · about

  1. 0:00Start
  2. 1:45A Brief History of Iteration
  3. 1:55External Iteration
  4. 4:20The Semantics of #each
  5. 5:14For Each Element
  6. 9:19#detect
  7. 9:50Caveat Implementor
  8. 10:41Basis Method
  9. 13:27Defining #hash
  10. 15:52The Moral of the Story
  11. 16:47Other Common Ruby Semantics Your Classes Should Understand
  12. 18:26Generators
  13. 27:27#select
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.