~/talk

Algebraic Data Types + Pattern Matching = Elegant and readable Java code

Talkat JCON EUROPE 2025 · 2025-05-12..05-15· [java]
slides:none on file

Builds a working cryptarithmetic solver for SEND + MORE = MONEY using Java’s Project Amber features, implementing expressions as a sealed Expression hierarchy and evaluation via a pattern-matching switch. Uses records and sealed interfaces for product/sum types, a DFS generator to reduce ~90 million raw combinations to ~181,000 constrained combos, and checks constraints (unique-values, equality) with expression evaluation. The unit test runs and finds a valid assignment; source code is on GitHub. record deconstruction and guarded patterns

AI-written summary · about

  1. 0:00Introduction
  2. 0:45Outline
  3. 1:19Questions
  4. 1:38Puzzle
  5. 2:31Rules
  6. 4:22Problem Analysis
  7. 5:20Constraint Programming
  8. 6:00Solution Design
  9. 7:16Expression Evaluation
  10. 9:03Algebraic Data Types
  11. 9:27Product Types
  12. 10:12Sum Types
  13. 11:02Pattern Matching
  14. 11:27Instance of
  15. 12:41Switch
  16. 13:40Primitive Types in Patterns
  17. 14:19Solving the Problem
  18. 15:34Implementation
  19. 17:09Seal Interface
  20. 23:16Generator
  21. 23:50Puzzle constraint
~/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.