Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions concepts/recursion/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions exercises/concept/backyard-birdcount/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- )
Expand Down
5 changes: 5 additions & 0 deletions exercises/concept/boutique-bookkeeping/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Loading