Lazy Ruby - Jason Arhart

B044a0f039af800f4df09bf3b2465f18?s=47 Las Vegas Ruby Group
April 24, 2013
82

Lazy Ruby - Jason Arhart

B044a0f039af800f4df09bf3b2465f18?s=128

Las Vegas Ruby Group

April 24, 2013
Tweet

Transcript

  1. Ruby Laziness Jason Arhart Thursday, August 1, 13

  2. Ruby Laziness Being lazy using Ruby Thursday, August 1, 13

  3. Ruby Laziness Being lazy using Ruby Thursday, August 1, 13

  4. Ruby Laziness Lazy Evaluation in Ruby Thursday, August 1, 13

  5. Problem Say we want to write a function that: Thursday,

    August 1, 13
  6. Problem Say we want to write a function that: •

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

    Takes a collection • Applies a function f to each element Thursday, August 1, 13
  8. 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
  9. 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
  10. 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
  11. Solution? Thursday, August 1, 13

  12. Solution? Thursday, August 1, 13

  13. Solution? Thursday, August 1, 13

  14. Solution? Thursday, August 1, 13

  15. Solution? Thursday, August 1, 13

  16. Solution? Thursday, August 1, 13

  17. Solution? Thursday, August 1, 13

  18. Solution? Thursday, August 1, 13

  19. Solution? Thursday, August 1, 13

  20. Solution? Thursday, August 1, 13

  21. Solution? Thursday, August 1, 13

  22. Solution? Thursday, August 1, 13

  23. Solution? Thursday, August 1, 13

  24. Solution? Thursday, August 1, 13

  25. Solution? Thursday, August 1, 13

  26. Solution? Thursday, August 1, 13

  27. Solution? Thursday, August 1, 13

  28. Solution? Thursday, August 1, 13

  29. Solution? Thursday, August 1, 13

  30. Solution? Thursday, August 1, 13

  31. Computer Science Thursday, August 1, 13

  32. Linked Lists Thursday, August 1, 13

  33. Linked Lists List ≔ emptyList ⊕ (head : Elem) ⊗

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

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

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

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

    (tail : List) Thursday, August 1, 13
  38. Linked Lists 1 2 5 42 Thursday, August 1, 13

  39. Linked Lists Thursday, August 1, 13

  40. Linked Lists Thursday, August 1, 13

  41. Linked Lists Thursday, August 1, 13

  42. Linked Lists Thursday, August 1, 13

  43. Linked Lists Thursday, August 1, 13

  44. Linked Lists Thursday, August 1, 13

  45. Linked Lists Thursday, August 1, 13

  46. Linked Lists Thursday, August 1, 13

  47. Linked Lists Thursday, August 1, 13

  48. Linked Lists Thursday, August 1, 13

  49. Linked Lists Thursday, August 1, 13

  50. Linked Lists Thursday, August 1, 13

  51. Linked Lists Thursday, August 1, 13

  52. Linked Lists Thursday, August 1, 13

  53. Linked Lists Thursday, August 1, 13

  54. Linked Lists Thursday, August 1, 13

  55. Linked Lists Thursday, August 1, 13

  56. Creating Linked Lists Thursday, August 1, 13

  57. Creating Linked Lists Thursday, August 1, 13

  58. Creating Linked Lists Thursday, August 1, 13

  59. Creating Linked Lists Thursday, August 1, 13

  60. Linked List Constructor Thursday, August 1, 13

  61. Linked List Constructor Thursday, August 1, 13

  62. Linked List Constructor Thursday, August 1, 13

  63. Linked List Constructor Thursday, August 1, 13

  64. Linked List Constructor Thursday, August 1, 13

  65. Linked List Constructor Thursday, August 1, 13

  66. Strict vs. Non-Strict Thursday, August 1, 13

  67. Strict Thursday, August 1, 13

  68. Non-Strict Thursday, August 1, 13

  69. Get Lazy! Thursday, August 1, 13

  70. Lazy Evaluation Thursday, August 1, 13

  71. Lazy Evaluation Thursday, August 1, 13

  72. Lazy Evaluation Thursday, August 1, 13

  73. Lazy Evaluation Thursday, August 1, 13

  74. Lazy Evaluation Thursday, August 1, 13

  75. Lazy Evaluation Thursday, August 1, 13

  76. Lazy Evaluation Thursday, August 1, 13

  77. Lazy Evaluation Thursday, August 1, 13

  78. Live Demo! Thursday, August 1, 13

  79. Lazy List (Stream) Thursday, August 1, 13

  80. Lazy List (Stream) Thursday, August 1, 13

  81. Lazy List (Stream) Thursday, August 1, 13

  82. Lazy List (Stream) Thursday, August 1, 13

  83. Lazy List (Stream) Thursday, August 1, 13

  84. Lazy List (Stream) Thursday, August 1, 13

  85. Lazy List (Stream) Thursday, August 1, 13

  86. Lazy List (Stream) Thursday, August 1, 13

  87. Lazy List (Stream) Thursday, August 1, 13

  88. Stream Constructor Thursday, August 1, 13

  89. Stream Constructor Thursday, August 1, 13

  90. Stream Constructor Thursday, August 1, 13

  91. Stream Constructors Thursday, August 1, 13

  92. Stream Constructors Thursday, August 1, 13

  93. Stream Constructors Thursday, August 1, 13

  94. Stream Constructors Thursday, August 1, 13

  95. Stream Constructors Thursday, August 1, 13

  96. Live Demo! Thursday, August 1, 13

  97. Stream Operations Thursday, August 1, 13

  98. Stream Operations Thursday, August 1, 13

  99. Stream Operations Thursday, August 1, 13

  100. Stream Operations Thursday, August 1, 13

  101. Stream Operations Thursday, August 1, 13

  102. Stream Operations Thursday, August 1, 13

  103. Live Demo! Thursday, August 1, 13

  104. Solution! Thursday, August 1, 13

  105. Ruby 2.0 gets Lazy! Thursday, August 1, 13

  106. Ruby 2.0 gets #lazy! Thursday, August 1, 13

  107. Ruby 2.0 gets #lazy! Thursday, August 1, 13

  108. RSpec is lazy! Thursday, August 1, 13

  109. RSpec is lazy! Thursday, August 1, 13

  110. RSpec is lazy! Thursday, August 1, 13

  111. RSpec is lazy! Thursday, August 1, 13

  112. Questions? Thursday, August 1, 13