About
## The problem it solves
Students learning functional programming are told that evaluation is "just rewriting expressions," but they never get to see it happen. They have to run `foldr` or `map` in their heads, and when they get the order wrong, nothing shows them which step went wrong.
Redex shows the evaluation one rewrite at a time. You paste a small Haskell-like program, press **Run**, and step through it. Each step highlights the sub-expression that changes next, and lists are drawn as rows of boxes, so you can watch `foldl (+) 0 (map (\x -> x * x) [1, 2, 3])` become `14` without guessing.
**What people can use it for**
- **Students** can step forward and back through `map`, `filter`, `foldl`, `foldr`, `let`, and lambda application to see the evaluation order — for example, why `foldl` and `foldr` build their results differently.
- **Teachers** can share a link to an exact program, embed the stepper in a lesson page, or put it on a projector during class.
- **Practice mode** asks the student to click the sub-expression they think changes next and checks the answer against the real evaluator, so a student can test what they understand on their own.
- **Debugging intuition:** when a program can't continue — for example `1 + True` — Redex marks the exact sub-expression that is stuck and explains why, instead of showing a generic error.
**What it makes easier or safer**
- **No setup:** it runs fully in the browser with nothing to install and no compiler or GHC.
- **The display can be trusted:** the evaluator is a pure function. It builds every frame before anything is shown, so the animation never skips a step, and every rewrite on screen is one the evaluator actually produced.
- **Practice scoring matches what students see:** practice mode is graded against the same frames shown in watch mode, so the score always agrees with the stepper.
## Challenges we ran into
**1. Keeping the highlight on the node that actually changed**
The stepper lights the sub-expression that gets rewritten next, and practice mode grades a student's click against that same location. If the path returned by `step` points at the wrong node, every highlight is off and every practice answer is graded wrong. I fixed this by making `step` return the path together with the rewrite. A property test then checks, over randomly generated programs, that the node at the returned path is the one that changed and that nothing else did.
**2. Making `map` look like what students picture**
My first `map` rule was the textbook recursive one, `map f (x : xs) → f x : map f xs`. It is correct, but on screen it produces a chain of cons cells instead of a list. I replaced it with a rule that expands the whole list into a row of applications in one step. Each box then reduces in place, so `map (\x -> x * x) [1, 2, 3]` looks like three boxes turning into `[1, 4, 9]`.
**3. Drawing expressions without overflowing the screen**
I prototyped two layouts on real traces. Fully nested boxes overflowed a 1280 px window on the first frame of sum-of-squares, and the `foldl` spine stacked into a tall column that pushed the list off screen. Inline code text with lists drawn as boxes still reads as a single line, so I went with that. A cross-fade between frames made the whole line blink. Layout animations keyed by node path fixed it: unchanged parts keep their place and only the rewritten node moves.
**4. Programs that never stop or keep growing**
Some programs loop forever or grow without bound, and building every frame up front could freeze the browser tab. `trace` now stops at 1,000 steps or 5,000 nodes and tells the user which limit it hit, so the page stays responsive.
**5. Clear errors instead of crashes**
Inputs like `1 + True`, `1 / 0`, or an unbound variable used to have nowhere to go. I added a stuck result that carries the exact path and a plain reason, for example `"+ needs two numbers"` or `"division by zero"`. The UI lights that sub-expression in red instead of showing a generic error.
**6. Choosing the language**
I started out planning to write the interpreter in Haskell. I don't know Haskell well, and the problem statement doesn't require a specific language, so I switched to TypeScript written in a pure functional style: immutable tagged unions, no mutation, and no global state. That kept the FP design and let me finish within the hackathon.
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.









