~/talk

lazy-seq – a historic view and why it is misunderstood

Talkat EuroClojure 2012 · 2012-05-17..05-18· [functional-programming]
links:none on file
slides:none on file

A concise history and practical stance: lazy cons lets code build infinite structures like numbers infinite sequence by deferring tails, but causes stack overflows when many sequence wrappers pile up and leaks when code holds the head; operations like drop/filter reveal that lazy cons cannot defer knowing emptiness, so Clojure introduces lazy-cons vs lazy-seq (the latter delays creating a real seq and adds rest/seq semantics) — key rule: always call seq on a lazy-seq before testing emptiness. Reducers and chunked sequences (array-based chunks) try to mitigate overhead but do not replace lazy-seq.

AI-written summary · about

  1. 0:00Introduction
  2. 1:14Origins of sequences
  3. 3:01Why lazy cons was added
  4. 4:06Infinite sequences with lazy cons
  5. 5:34Dynamic context pitfalls
  6. 6:18Stack overflows with sequences
  7. 7:22Memory efficiency
  8. 8:23Memory leaks from heads
  9. 9:05What defines a sequence
  10. 10:09Sequences as views
  11. 11:34Seekable collections
  12. 12:39Implicit seek on strings
  13. 13:20Generating sequences
  14. 14:47Side effects in sequences
  15. 15:30Cycle and concat
  16. 16:16Filtering sequences
  17. 16:58Historic cut in sequences
  18. 18:29lazy-seq macro
  19. 19:10Changes to sequence interface
  20. 20:32Full laziness
  21. 21:36Loss of nil punning
  22. 21:58Is lazy-seq still a sequence
  23. 22:40Sequences vs seekables
  24. 23:26Nil safety
  25. 23:50Polymorphism in sequences
  26. 25:13Improving sequence functions
  27. 26:17Reducers vs sequences
  28. 27:40Advantages of reducers
  29. 28:42Future of lazy-seq
  30. 29:03Q&A
~/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.