Skip to content

Commit eb86051

Browse files
sequences protocol links
[no important files changed]
1 parent 0389d2c commit eb86051

16 files changed

Lines changed: 37 additions & 19 deletions

File tree

concepts/arrays/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ the stack:
1313
| `<array>`| `( n elt -- array )``n` copies of `elt` |
1414
| `array?` | `( obj -- ? )` — type predicate |
1515

16-
A few protocol words from `sequences` come up so often with
16+
A few [protocol][sequence-protocol] words from `sequences` come up so often with
1717
arrays that they are worth knowing as a unit:
1818

1919
| word | effect |
@@ -39,3 +39,4 @@ sequence — handy when an array's elements should be deduplicated
3939
or checked for duplicates without first converting to a hash-set.
4040

4141
[sets]: https://docs.factorcode.org/content/vocab-sets.html
42+
[sequence-protocol]: https://docs.factorcode.org/content/article-sequence-protocol.html

concepts/assocs/about.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About
22

3-
`assocs` is a protocol, not a single data type. Hashtables (`H{ }`),
3+
`assocs` is a [protocol][assoc-protocol], not a single data type. Hashtables (`H{ }`),
44
association lists (sequences of `{ key value }` pairs), and tree
55
maps all implement it, and most words on assocs are interchangeable
66
between them.
@@ -29,3 +29,5 @@ but most exercise-level work involves a small set:
2929

3030
`sort-keys` and `sort-values` (in `sorting`) sort an alist by the
3131
chosen field.
32+
33+
[assoc-protocol]: https://docs.factorcode.org/content/article-assocs-protocol.html

concepts/assocs/introduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Introduction
22

33
Factor's associative arrays — hashtables and friends — share a
4-
common protocol from [`assocs`][assocs]. The hashtable literal is
4+
common [protocol][assoc-protocol] from [`assocs`][assocs]. The hashtable literal is
55
`H{ }`:
66

77
```factor
@@ -29,3 +29,4 @@ Hashtables are *mutable* — `clone` an `H{ }` literal before
2929
modifying so the literal isn't shared between calls.
3030

3131
[assocs]: https://docs.factorcode.org/content/vocab-assocs.html
32+
[assoc-protocol]: https://docs.factorcode.org/content/article-assocs-protocol.html

concepts/deques/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`<dlist>` (in [`dlists`][dlists]) constructs a fresh doubly-linked
44
list. The operations live in [`deques`][deques] and dispatch on
5-
the deque protocol, so other containers — chiefly `<dlist>`
5+
the [deque protocol][deque-protocol], so other containers — chiefly `<dlist>`
66
can implement them.
77

88
| word | effect |
@@ -83,3 +83,4 @@ finite, manageable set.
8383
[dlists]: https://docs.factorcode.org/content/vocab-dlists.html
8484
[memoize]: https://docs.factorcode.org/content/vocab-memoize.html
8585
[memo-decl]: https://docs.factorcode.org/content/word-MEMO__colon__%2Csyntax.html
86+
[deque-protocol]: https://docs.factorcode.org/content/article-deques.html

concepts/hash-sets/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About
22

3-
Hash-sets implement the [`sets`][sets] protocol with hashing
3+
Hash-sets implement the [`sets`][sets] [protocol][set-protocol] with hashing
44
under the hood, giving O(1) average insert, lookup, and delete.
55
They're mutable in place, which makes them ideal for the
66
*visited set* pattern in graph traversals.
@@ -64,3 +64,4 @@ reachability question, which is why a vector-as-stack is enough
6464
[dlist]: https://docs.factorcode.org/content/word-__lt__dlist__gt__%2Cdlists.html
6565

6666
[sets]: https://docs.factorcode.org/content/vocab-sets.html
67+
[set-protocol]: https://docs.factorcode.org/content/article-sets.html

concepts/io-streams/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Factor splits stream I/O into two layers. The lower layer is the
44
*explicit-stream* API: every word takes the stream as an
55
argument. The upper layer is the *ambient-stream* API: short,
66
one-line words that act on whichever stream is currently bound.
7-
Both layers sit on the same protocol — the upper-layer words
7+
Both layers sit on the same [protocol][stream-protocol] — the upper-layer words
88
just look up the ambient stream and forward the call.
99

1010
## Explicit-stream words
@@ -101,3 +101,4 @@ plugs into the protocol — see the `streams` concept (taught in
101101
[io]: https://docs.factorcode.org/content/vocab-io.html
102102
[io.streams.string]: https://docs.factorcode.org/content/vocab-io.streams.string.html
103103
[io.files]: https://docs.factorcode.org/content/vocab-io.files.html
104+
[stream-protocol]: https://docs.factorcode.org/content/article-stream-protocol.html

concepts/sequences/about.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# About
22

3-
The [`sequences`][sequences] vocabulary defines a single protocol
4-
that arrays (`{ … }`), vectors (`V{ … }`), strings, ranges, and
3+
The [`sequences`][sequences] vocabulary defines a single
4+
[protocol][sequence-protocol] that arrays (`{ … }`), vectors (`V{ … }`), strings, ranges, and
55
slices all implement. Anything you can do with one, you can do
66
with the others.
77

@@ -63,3 +63,4 @@ V{ 1 2 3 } >array . ! => { 1 2 3 }
6363
```
6464

6565
[sequences]: https://docs.factorcode.org/content/vocab-sequences.html
66+
[sequence-protocol]: https://docs.factorcode.org/content/article-sequence-protocol.html

concepts/sequences/introduction.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Introduction
22

33
Most data in Factor lives in *sequences*. Arrays (`{ … }`), vectors
4-
(`V{ … }`), and strings all share the same protocol from
5-
[`sequences`][sequences].
4+
(`V{ … }`), and strings all share the same [protocol][sequence-protocol]
5+
from [`sequences`][sequences].
66

77
```factor
88
{ 1 2 3 } length . ! => 3
@@ -24,3 +24,4 @@ back from a generic operation.
2424
[arrays]: https://docs.factorcode.org/content/vocab-arrays.html
2525

2626
[sequences]: https://docs.factorcode.org/content/vocab-sequences.html
27+
[sequence-protocol]: https://docs.factorcode.org/content/article-sequence-protocol.html

concepts/streams/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About
22

3-
Factor's I/O is built on a single protocol that any data source
3+
Factor's I/O is built on a single [protocol][stream-protocol] that any data source
44
or sink can implement. The bundled streams — `<file-reader>`,
55
`<file-writer>`, `<string-reader>`, `<string-writer>`,
66
network sockets, byte arrays, ttys — are all classes that
@@ -88,3 +88,4 @@ threading it through every call.
8888

8989
[io]: https://docs.factorcode.org/content/vocab-io.html
9090
[destructors]: https://docs.factorcode.org/content/vocab-destructors.html
91+
[stream-protocol]: https://docs.factorcode.org/content/article-stream-protocol.html

concepts/streams/introduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A *stream* in Factor is anything you can read bytes from or write
44
bytes to. Files, sockets, in-memory buffers, and your own custom
5-
wrappers all participate in the same small protocol from
5+
wrappers all participate in the same small [protocol][stream-protocol] from
66
[`io`][io].
77

88
The protocol's two halves are mixins: `input-stream` for things
@@ -65,3 +65,4 @@ USING: io io.streams.string ;
6565

6666
[io]: https://docs.factorcode.org/content/vocab-io.html
6767
[destructors]: https://docs.factorcode.org/content/vocab-destructors.html
68+
[stream-protocol]: https://docs.factorcode.org/content/article-stream-protocol.html

0 commit comments

Comments
 (0)