~/talk

Refactoring toward a more functional style in F#

TalkinFrenchat Scala.IO 2017 · 2017-11-02..11-03· [functional-programming]
slides:none on file

Shows refactoring an F# implementation of the Trivia kata from mutable, object-style code into deterministic, testable functional code: mutable arrays/lists are replaced with immutable lists/stacks, mutable state is modeled with records and discriminated unions (sum/product types), side effects are isolated by capturing console output and using a golden‑master test, and imperative loops are rewritten as pure functions and recursion. Uses F# scripts and Visual Studio Code to build a game‑state pipeline for a 4‑pile, 12‑space game, with a golden master preserving behavior when players answer incorrectly about 1 in 10 runs.

AI-written summary · about

  1. 0:00Introduction
  2. 2:46Functional style concepts
  3. 3:07Trivia kata
  4. 10:05Business types
  5. 15:43Mutability reduction
  6. 25:50Product and sum types
  7. 27:15Pure function transforms
  8. 39:02Initial state with sum types
  9. 41:16Recursion in game logic
  10. 45:50Sum types benefits
  11. 47:14Side effects and conclusion
~/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.