~/talk

Swift Tutorial - Exploring Swift Sequences in Depth

Talkat Swift Craft 2024 · 2024-05-21..05-24· [swift, compilers-and-language-design]
links:none on file
slides:none on file

Deep dive into how Swift Sequences and Collections actually behave: shows concrete code for lazy sequences that avoid repeated array allocations in a 1,000,000-range pipeline (finding the first 100 even numbers containing “v” returns 12 then 726), demonstrates that lazy access recomputes unless materialized, uses unfoldSequence to stream a file line-by-line instead of loading 236,000 words into memory, builds a recursive sequence for filesystem traversal, implements a 2D grid, runs Game of Life, and draws a spirograph from 100,000 points while leveraging the Swift Algorithms package and collection(of: 1)/empty-collection optimizations.

AI-written summary · about

  1. 0:00Introduction to sequences
  2. 1:25Iterator protocol basics
  3. 2:46Sequence extension methods
  4. 4:52Reduce and sequence extensions
  5. 5:57Lazy sequences explained
  6. 9:10Lazy vs non-lazy performance
  7. 11:58Collections vs sequences
  8. 13:22Collection protocol details
  9. 15:46Unordered collections
  10. 17:31Dictionary and set indexing
  11. 18:56Count and empty checks
  12. 20:58Subsequences and slicing
  13. 21:39Bidirectional collections
  14. 22:23Random access collections
  15. 23:26Unfold sequences
  16. 26:13Empty collection and collection of one
  17. 27:36Consuming sequences properly
  18. 29:45Flexible sequence parameters
  19. 30:26Swift Algorithms package
  20. 31:29Chain and windowing sequences
  21. 32:53Striding sequences
  22. 34:21Stride date sequences
  23. 36:29File line iteration
  24. 38:56Recursive sequences
  25. 42:25Conforming to sequence
  26. 45:562D grid collections
  27. 47:00Custom 2D grid implementation
  28. 50:11Window sequences for grids
  29. 51:35Spirograph with unfold sequence
  30. 55:22Summary and best practices
~/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.