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
8 changes: 8 additions & 0 deletions concepts/assocs/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/article-assocs.html",
"description": "Associative mapping — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-assocs.html",
"description": "assocs vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-hashtables.html",
"description": "Hashtables — the default associative implementation"
}
]
8 changes: 8 additions & 0 deletions concepts/basics/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/article-effects.html",
"description": "Stack effect declarations — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/article-shuffle-words.html",
"description": "Shuffle words: dup, drop, swap, over, pick, and friends"
},
{
"url": "https://docs.factorcode.org/content/article-cookbook.html",
"description": "Factor cookbook — a tour of the language for new readers"
}
]
4 changes: 4 additions & 0 deletions concepts/booleans/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/article-booleans.html",
"description": "Booleans — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-kernel.html",
"description": "kernel vocabulary — home of and, or, not, xor"
}
]
4 changes: 4 additions & 0 deletions concepts/case/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/word-case,combinators.html",
"description": "case — combinators vocabulary"
},
{
"url": "https://docs.factorcode.org/content/vocab-combinators.html",
"description": "combinators vocabulary — home of case, cond, and cond>quot"
}
]
8 changes: 8 additions & 0 deletions concepts/combinators/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/article-dataflow-combinators.html",
"description": "Dataflow combinators — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/article-cleave-combinators.html",
"description": "Cleave combinators — bi, tri, and their multi-input cousins"
},
{
"url": "https://docs.factorcode.org/content/vocab-combinators.html",
"description": "combinators vocabulary reference"
}
]
4 changes: 4 additions & 0 deletions concepts/conditionals/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/article-conditionals.html",
"description": "Conditionals — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-combinators.html",
"description": "combinators vocabulary — home of cond and case"
}
]
4 changes: 4 additions & 0 deletions concepts/curry-compose-fry/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/vocab-fry.html",
"description": "fry vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-dataflow-combinators.html",
"description": "Dataflow combinators — context for curry and compose"
}
]
8 changes: 8 additions & 0 deletions concepts/destructors/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/article-destructors.html",
"description": "Destructors — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-destructors.html",
"description": "destructors vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/word-cleanup%2Ccontinuations.html",
"description": "cleanup — the underlying continuations primitive"
}
]
4 changes: 4 additions & 0 deletions concepts/dynamic-variables/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/vocab-namespaces.html",
"description": "namespaces vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-namespaces-global.html",
"description": "Global namespaces — how dynamic variables are scoped"
}
]
4 changes: 4 additions & 0 deletions concepts/errors/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/article-errors.html",
"description": "Errors — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-continuations.html",
"description": "continuations vocabulary — home of throw, catch, and cleanup"
}
]
4 changes: 4 additions & 0 deletions concepts/indexed-iteration/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/vocab-sequences.html",
"description": "sequences vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-sequences.html",
"description": "Sequences — Factor handbook (covers each-index, map-index, ...)"
}
]
4 changes: 4 additions & 0 deletions concepts/locals/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/vocab-locals.html",
"description": "locals vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-locals.html",
"description": "Lexical variables — Factor handbook"
}
]
8 changes: 8 additions & 0 deletions concepts/quotations-call/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/word-call,kernel.html",
"description": "call — kernel vocabulary"
},
{
"url": "https://docs.factorcode.org/content/vocab-kernel.html",
"description": "kernel vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-dataflow-combinators.html",
"description": "Dataflow combinators — call sites for quotations"
}
]
4 changes: 4 additions & 0 deletions concepts/quotations/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/article-quotations.html",
"description": "Quotations — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-quotations.html",
"description": "quotations vocabulary reference"
}
]
4 changes: 4 additions & 0 deletions concepts/recursion/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/article-words.html",
"description": "Defining words — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/article-cookbook.html",
"description": "Factor cookbook — control-flow idioms in depth"
}
]
8 changes: 8 additions & 0 deletions concepts/sequences/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/article-sequences.html",
"description": "Sequences — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-sequences.html",
"description": "sequences vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/vocab-arrays.html",
"description": "arrays vocabulary — the default sequence type"
}
]
2 changes: 1 addition & 1 deletion concepts/subclasses/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ USING: accessors ;
an existing class by a runtime predicate. A separate Factor
feature; not covered here.

[generics]: https://docs.factorcode.org/content/article-generic-words.html
[generics]: https://docs.factorcode.org/content/article-generic.html
[accessors]: https://docs.factorcode.org/content/vocab-accessors.html
2 changes: 1 addition & 1 deletion concepts/subclasses/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Generic methods dispatched on the parent fire for every
descendant — but that lesson lives with [`generics`][generics];
this exercise stays focused on the data side.

[generics]: https://docs.factorcode.org/content/article-generic-words.html
[generics]: https://docs.factorcode.org/content/article-generic.html
8 changes: 8 additions & 0 deletions concepts/subclasses/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
{
"url": "https://docs.factorcode.org/content/article-tuple-subclassing.html",
"description": "Tuple subclassing — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/article-generic.html",
"description": "Generic words — method dispatch over class hierarchies"
},
{
"url": "https://docs.factorcode.org/content/vocab-accessors.html",
"description": "accessors vocabulary — auto-generated slot readers and writers"
}
]
4 changes: 4 additions & 0 deletions concepts/tuples/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/article-tuples.html",
"description": "Tuples — Factor handbook"
},
{
"url": "https://docs.factorcode.org/content/vocab-accessors.html",
"description": "accessors vocabulary — auto-generated slot readers and writers"
}
]
4 changes: 4 additions & 0 deletions concepts/unicode/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
{
"url": "https://docs.factorcode.org/content/vocab-unicode.html",
"description": "unicode vocabulary reference"
},
{
"url": "https://docs.factorcode.org/content/article-strings.html",
"description": "Strings — Factor handbook"
}
]
4 changes: 2 additions & 2 deletions concepts/vocabularies/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Vocabularies: official Factor documentation"
},
{
"url": "https://docs.factorcode.org/content/article-vocab-search.html",
"description": "Vocabulary search path"
"url": "https://docs.factorcode.org/content/article-syntax.html",
"description": "Syntax — including USING:, USE:, IN:"
}
]
4 changes: 2 additions & 2 deletions concepts/wire-format/links.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"description": "Cleave combinators — including 2bi, 3bi, 2tri, 3tri"
},
{
"url": "https://docs.factorcode.org/content/vocab-slices.html",
"description": "slices vocabulary — head-slice, tail-slice, and friends"
"url": "https://docs.factorcode.org/content/word-slice%2Csequences.html",
"description": "slice — sequences vocabulary (head-slice, tail-slice and friends)"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ every descendant unless a more-specific override takes
priority. You'll see that in `boatswains-bilge` immediately
after this exercise.

[generics]: https://docs.factorcode.org/content/article-generic-words.html
[generics]: https://docs.factorcode.org/content/article-generic.html
3 changes: 2 additions & 1 deletion exercises/concept/log-levels/.docs/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

- Cut the line on `": "` with `split1` (stack effect
`( seq subseq -- before after )`); discard the part before, keep
the part after.
the part after. `nip ( x y -- y )` from `kernel` drops the second
value down — so `split1 nip` keeps the right half.
- Strip whitespace from what's left with `[ blank? ] trim`.

## 2. Get log level from a log line
Expand Down
8 changes: 6 additions & 2 deletions exercises/concept/mosaic-mischief/.docs/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

## 2. Place a tile

- `set-nth` does the assignment.
- `set-nth` does the assignment, but it expects
`( elt n seq -- )` and the inputs arrive as `( row position colour -- )`.
`spin ( x y z -- z y x )` from `kernel` reorders three values on
the stack in a single word so they land in `set-nth`'s order.

## 3. Chip a tile out

- "Set this position to `f`" — same shape as task 2.
- "Set this position to `f`" — same shape as task 2, but you'll
need to push `f` onto the stack first.

## 4. Re-colour a tile

Expand Down
16 changes: 16 additions & 0 deletions exercises/concept/quayside-crew/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ USING: concurrency.promises kernel threads ;
hand-rolling them is useful when each task does something other
than "compute one element."

The typical fan-out/join shape over a sequence is: for each input
make a fresh promise, spawn a thread that does the work and
`fulfill`s the promise, collect every promise into a sequence, then
`?promise` each one to wait for completion. Locals make this
readable — bind the promise to a name with `:>` inside a `[| | ]`
lambda so the spawned quotation can close over it:

```factor
! DOCTEST: SKIP (`:>` only works inside [let, [|, or :: forms)
inputs [| x |
<promise> :> p
[ x do-work t p fulfill ] "worker" spawn drop
p
] map [ ?promise drop ] each
```

## Locks — mutual exclusion

```
Expand Down
17 changes: 17 additions & 0 deletions exercises/concept/rpn-calculator/.docs/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,22 @@
sequence. Every iteration sees the running stack, pops the next
operation off the program, and applies it.

## 5. Evaluate by name

- Look each name up in the assoc with `at` (in [`assocs`][assocs])
to get its operation, then reuse `evaluate`.
- A fry quotation `'[ _ at ]` from [`curry-compose-fry`][fry]
closes over the assoc so `map` can swap each name for its
operation in one pass.

## 6. Divide with safety

- `throw` (in [`kernel`][kernel]) raises an error. `zero-divisor-error`
is already declared, so `zero-divisor-error throw` is the call.
- Guard the divide path with an `if` that checks whether the
bottom-most divisor is `0`.

[sequences]: https://docs.factorcode.org/content/vocab-sequences.html
[kernel]: https://docs.factorcode.org/content/vocab-kernel.html
[assocs]: https://docs.factorcode.org/content/vocab-assocs.html
[fry]: https://docs.factorcode.org/content/vocab-fry.html