Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lazy Ruby - Jason Arhart

Las Vegas Ruby Group
April 24, 2013
97

Lazy Ruby - Jason Arhart

Las Vegas Ruby Group

April 24, 2013
Tweet

Transcript

  1. Problem Say we want to write a function that: •

    Takes a collection Thursday, August 1, 13
  2. Problem Say we want to write a function that: •

    Takes a collection • Applies a function f to each element Thursday, August 1, 13
  3. Problem Say we want to write a function that: •

    Takes a collection • Applies a function f to each element • Selects the even numbers from the results Thursday, August 1, 13
  4. Problem Say we want to write a function that: •

    Takes a collection • Applies a function f to each element • Selects the even numbers from the results • Applies a function g to each of those Thursday, August 1, 13
  5. Problem Say we want to write a function that: •

    Takes a collection • Applies a function f to each element • Selects the even numbers from the results • Applies a function g to each of those • Returns those results Thursday, August 1, 13
  6. Linked Lists List ≔ emptyList ⊕ (head : Elem) ⊗

    (tail : List) Thursday, August 1, 13
  7. Linked Lists List ≔ emptyList ⊕ (head : Elem) ⊗

    (tail : List) Thursday, August 1, 13
  8. Linked Lists List ≔ emptyList ⊕ (head : Elem) ⊗

    (tail : List) Thursday, August 1, 13
  9. Linked Lists List ≔ emptyList ⊕ (head : Elem) ⊗

    (tail : List) Thursday, August 1, 13
  10. Linked Lists List ≔ emptyList ⊕ (head : Elem) ⊗

    (tail : List) Thursday, August 1, 13