~/talk

The Functional Alternative

Talkat rubyday 2023 · on Friday, 2023-06-16· [ruby]
name:Ju Liu
slides:none on file

Generate 100 random numbers into a file, write a Ruby script that prints index and that many hashes, and then try to group consecutive equal rows imperatively — the first solution accumulates state, hits an off by one bug and misses the final group, and ends up messy but functional. Rework the problem as a pure data transformation (each_with_index, reduce/slice to build groups, then render), which runs, is easier to reason about, and makes the new requirement (group if distance ≤ 1) a one-line change.

AI-written summary · about

  1. 0:00Functional programming exercise
  2. 5:05Imperative Ruby solution
  3. 15:36Critique of imperative flaws
  4. 20:42Transforming data functionally
  5. 31:56Adapting functional solution
  6. 36:10Readability and maintainability
  7. 40:27ChatGPT for text processing
  8. 43:51ChatGPT few-shot demo
~/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.