From b4fea85d79fc34ddc688e09e18e915b5454aeb65 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Tue, 23 Jun 2026 13:57:35 +1000 Subject: [PATCH] Simplify recursion introduction http://forum.exercism.org/t/factor-track-feedback/60226/3 --- concepts/recursion/about.md | 2 -- exercises/concept/backyard-birdcount/.docs/introduction.md | 4 +--- exercises/concept/boutique-bookkeeping/.docs/introduction.md | 5 +++++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/concepts/recursion/about.md b/concepts/recursion/about.md index 58028270..eb689ef4 100644 --- a/concepts/recursion/about.md +++ b/concepts/recursion/about.md @@ -17,8 +17,6 @@ A few things to know: - Plain `:` definitions can recurse with no special syntax. The compiler infers stack effects across the recursive call. -- `inline` words that recurse need the additional `recursive` - modifier so the compiler knows the recursion is intentional. - `loop ( quot -- )` lets you iterate a quotation that returns a boolean — keep going while it's truthy. - Tail calls compile to jumps, so deeply recursive words don't diff --git a/exercises/concept/backyard-birdcount/.docs/introduction.md b/exercises/concept/backyard-birdcount/.docs/introduction.md index a417aa55..c345c7e3 100644 --- a/exercises/concept/backyard-birdcount/.docs/introduction.md +++ b/exercises/concept/backyard-birdcount/.docs/introduction.md @@ -6,9 +6,7 @@ spell a computation is **recursion** — a word that calls itself. ## Defining a recursive word -A `:` definition can call itself directly. The compiler can usually -infer the stack effect; if it can't, you can add the `recursive` -modifier to ask it to assume self-consistency: +A `:` definition can call itself directly: ```factor : count-down ( n -- ) diff --git a/exercises/concept/boutique-bookkeeping/.docs/introduction.md b/exercises/concept/boutique-bookkeeping/.docs/introduction.md index 10ec0f75..f4b4a450 100644 --- a/exercises/concept/boutique-bookkeeping/.docs/introduction.md +++ b/exercises/concept/boutique-bookkeeping/.docs/introduction.md @@ -212,6 +212,11 @@ USING: math sequences ; Words built only from literal quotations don't need `inline` — just the ones that pass an *incoming* quotation through. +If such an `inline` word ever calls *itself* — a recursive +combinator — declare it `; inline recursive` instead. Without the +extra word the compiler stops with *"The inline recursive word ... +must be declared recursive"*, which tells you exactly what to add. + ## Pulling the second element For a 2-element array, `second` returns its second element. `first`