Skip to content

Commit 18bd101

Browse files
authored
Merge pull request #9 from carpentry-org/veit/new-style-docs
fix: use new style docs to avoid unwanted code blocks
2 parents 2a0d095 + 011be00 commit 18bd101

11 files changed

Lines changed: 177 additions & 220 deletions

File tree

docs/Dimensional.html

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,11 @@ <h3 id="tabulate">
7272
(tabulate f)
7373
</pre>
7474
<p class="doc">
75-
<pre><code>Tabulate maps a `lookup` function (any function that takes an `Index` as an
76-
argument) over the positions of a sized functor.
77-
78-
`(tabulate (lookup f))= (id f)`
79-
80-
To make this function useful, one often needs to use an overarching context
81-
to ensure the resulting functor is sized appropriately.
82-
</code></pre>
75+
<p>Tabulate maps a <code>lookup</code> function (any function that takes an <code>Index</code> as an
76+
argument) over the positions of a sized functor.</p>
77+
<p><code>(tabulate (lookup f))= (id f)</code></p>
78+
<p>To make this function useful, one often needs to use an overarching context
79+
to ensure the resulting functor is sized appropriately.</p>
8380

8481
</p>
8582
</div>
@@ -99,17 +96,12 @@ <h3 id="transpose">
9996
(transpose f)
10097
</pre>
10198
<p class="doc">
102-
<pre><code>Transpose takes a sized functor whose inhabitants are sized functors and
103-
effectively swaps their sizes; it is equivalent to matrix transposition.
104-
105-
For example, given a Vector of Size 3 of Vectors of Size 2
106-
107-
`(Vector [(Vector [1 2]) (Vector [3 4]) (Vector [5 6])])`
108-
109-
transpose will return a Vector of size 2 of Vectors of size 3:
110-
111-
`(Vector [(Vector [1 3 5]) (Vector [2 4 6])])`
112-
</code></pre>
99+
<p>Transpose takes a sized functor whose inhabitants are sized functors and
100+
effectively swaps their sizes; it is equivalent to matrix transposition.</p>
101+
<p>For example, given a Vector of Size 3 of Vectors of Size 2</p>
102+
<p><code>(Vector [(Vector [1 2]) (Vector [3 4]) (Vector [5 6])])</code></p>
103+
<p>transpose will return a Vector of size 2 of Vectors of size 3:</p>
104+
<p><code>(Vector [(Vector [1 3 5]) (Vector [2 4 6])])</code></p>
113105

114106
</p>
115107
</div>

docs/Hompair.html

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,9 @@ <h3 id="empty?">
115115
(empty? pair)
116116
</pre>
117117
<p class="doc">
118-
<pre><code>Returns false. Hompairs may never be empty by definition.
119-
120-
```
121-
(empty? &amp;(Hompair.of 1 1))
118+
<p>Returns false. Hompairs may never be empty by definition.</p>
119+
<pre><code>(empty? &amp;(Hompair.of 1 1))
122120
=&gt; false
123-
```
124121
</code></pre>
125122

126123
</p>
@@ -161,12 +158,9 @@ <h3 id="len">
161158
(len pair)
162159
</pre>
163160
<p class="doc">
164-
<pre><code>Returns the length of a Hompair.
165-
166-
```
167-
(len (Hompair.of 1 1))
161+
<p>Returns the length of a Hompair.</p>
162+
<pre><code>(len (Hompair.of 1 1))
168163
=&gt; 2
169-
```
170164
</code></pre>
171165

172166
</p>
@@ -225,13 +219,10 @@ <h3 id="nth">
225219
(nth pair index)
226220
</pre>
227221
<p class="doc">
228-
<pre><code>Retrieves the nth value from a Hompair using the int value of `index`.
229-
If n is greater than or equal 1, returns the second member of the Hompair.
230-
231-
```
232-
(nth &amp;(Hompair 1 2) (Index.init 0))
222+
<p>Retrieves the nth value from a Hompair using the int value of <code>index</code>.
223+
If n is greater than or equal 1, returns the second member of the Hompair.</p>
224+
<pre><code>(nth &amp;(Hompair 1 2) (Index.init 0))
233225
=&gt; 1
234-
```
235226
</code></pre>
236227

237228
</p>
@@ -252,12 +243,9 @@ <h3 id="of">
252243
(of x y)
253244
</pre>
254245
<p class="doc">
255-
<pre><code>Constructs a new Hompair from values `x` and `y`.
256-
257-
```
258-
(Hompair.of 2 4)
246+
<p>Constructs a new Hompair from values <code>x</code> and <code>y</code>.</p>
247+
<pre><code>(Hompair.of 2 4)
259248
=&gt; (Hompair 2 4)
260-
```
261249
</code></pre>
262250

263251
</p>
@@ -336,12 +324,9 @@ <h3 id="replicate">
336324
(replicate x)
337325
</pre>
338326
<p class="doc">
339-
<pre><code>Creates a new Hompair with `x` as both of its members.
340-
341-
```
342-
(Hompair.replicate 1)
327+
<p>Creates a new Hompair with <code>x</code> as both of its members.</p>
328+
<pre><code>(Hompair.replicate 1)
343329
=&gt; (Hompair 1 1)
344-
```
345330
</code></pre>
346331

347332
</p>
@@ -482,12 +467,9 @@ <h3 id="swap">
482467
(swap pair)
483468
</pre>
484469
<p class="doc">
485-
<pre><code>Swaps the position of each value in a Hompair.
486-
487-
```
488-
(swap &amp;(Hompair.of 1 2))
470+
<p>Swaps the position of each value in a Hompair.</p>
471+
<pre><code>(swap &amp;(Hompair.of 1 2))
489472
=&gt; (Hompair 2 1)
490-
```
491473
</code></pre>
492474

493475
</p>
@@ -548,8 +530,7 @@ <h3 id="zero">
548530
(zero)
549531
</pre>
550532
<p class="doc">
551-
<pre><code>Returns a Hompair of the zero values of a given type.
552-
</code></pre>
533+
<p>Returns a Hompair of the zero values of a given type.</p>
553534

554535
</p>
555536
</div>

docs/Size.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,9 @@ <h3 id="size">
215215
(size n)
216216
</pre>
217217
<p class="doc">
218-
<pre><code>Size types can be quite a pain to type out in full, as the rely on significant nesting.
219-
220-
The size macro generates an appropriate Size based on an integer value, and
221-
may be used to generate a size type in functions signatures and macros.
222-
</code></pre>
218+
<p>Size types can be quite a pain to type out in full, as the rely on significant nesting.</p>
219+
<p>The size macro generates an appropriate Size based on an integer value, and
220+
may be used to generate a size type in functions signatures and macros.</p>
223221

224222
</p>
225223
</div>

docs/Vector.html

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ <h3 id="empty">
134134
(empty)
135135
</pre>
136136
<p class="doc">
137-
<pre><code>Returns an empty Vector
138-
</code></pre>
137+
<p>Returns an empty Vector</p>
139138

140139
</p>
141140
</div>
@@ -155,8 +154,7 @@ <h3 id="head">
155154
(head v)
156155
</pre>
157156
<p class="doc">
158-
<pre><code>Returns the first element of a Vector.
159-
</code></pre>
157+
<p>Returns the first element of a Vector.</p>
160158

161159
</p>
162160
</div>
@@ -215,8 +213,7 @@ <h3 id="last">
215213
(last v)
216214
</pre>
217215
<p class="doc">
218-
<pre><code>Returns the last element of a Vector.
219-
</code></pre>
216+
<p>Returns the last element of a Vector.</p>
220217

221218
</p>
222219
</div>
@@ -255,9 +252,8 @@ <h3 id="map">
255252
(map f v)
256253
</pre>
257254
<p class="doc">
258-
<pre><code> Maps a function `f` over all the elements of a Vector and returns a new
259-
Vector containing the results.
260-
</code></pre>
255+
<p>Maps a function <code>f</code> over all the elements of a Vector and returns a new
256+
Vector containing the results.</p>
261257

262258
</p>
263259
</div>
@@ -277,14 +273,11 @@ <h3 id="nth">
277273
(nth v ix)
278274
</pre>
279275
<p class="doc">
280-
<pre><code>Retrieves the nth element of a Vector using a given `Index`.
281-
282-
The given `Index` must have a `Size` equivalent to the `Vector`'s size in
283-
its first position (the bound position).
284-
285-
If the `Index`'s Int value exceeds the length of the Vector, this
286-
function will return the last element of the Vector.
287-
</code></pre>
276+
<p>Retrieves the nth element of a Vector using a given <code>Index</code>.</p>
277+
<p>The given <code>Index</code> must have a <code>Size</code> equivalent to the <code>Vector</code>'s size in
278+
its first position (the bound position).</p>
279+
<p>If the <code>Index</code>'s Int value exceeds the length of the Vector, this
280+
function will return the last element of the Vector.</p>
288281

289282
</p>
290283
</div>
@@ -304,8 +297,7 @@ <h3 id="of">
304297
(of values)
305298
</pre>
306299
<p class="doc">
307-
<pre><code>Creates a new Vector from the contents of an Array literal.
308-
</code></pre>
300+
<p>Creates a new Vector from the contents of an Array literal.</p>
309301

310302
</p>
311303
</div>
@@ -364,8 +356,7 @@ <h3 id="push">
364356
(push x v)
365357
</pre>
366358
<p class="doc">
367-
<pre><code>Adds an element to the end of a Vector, returning a new Vector.
368-
</code></pre>
359+
<p>Adds an element to the end of a Vector, returning a new Vector.</p>
369360

370361
</p>
371362
</div>
@@ -424,8 +415,7 @@ <h3 id="tail">
424415
(tail v)
425416
</pre>
426417
<p class="doc">
427-
<pre><code>Returns all but the first element of a Vector as a new Vector.
428-
</code></pre>
418+
<p>Returns all but the first element of a Vector as a new Vector.</p>
429419

430420
</p>
431421
</div>
@@ -445,8 +435,7 @@ <h3 id="to-array">
445435
(to-array v)
446436
</pre>
447437
<p class="doc">
448-
<pre><code>Converts a Vector to an Array.
449-
</code></pre>
438+
<p>Converts a Vector to an Array.</p>
450439

451440
</p>
452441
</div>
@@ -466,8 +455,7 @@ <h3 id="zip">
466455
(zip f v v1)
467456
</pre>
468457
<p class="doc">
469-
<pre><code>Combines two Vectors using a binary function `f`.
470-
</code></pre>
458+
<p>Combines two Vectors using a binary function <code>f</code>.</p>
471459

472460
</p>
473461
</div>

docs/index-type.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,8 @@ <h3 id="index-to-int">
135135
(index-to-int ix)
136136
</pre>
137137
<p class="doc">
138-
<pre><code>Converts an index to a safe integer value, for sized functor element access.
139-
140-
The integer value will always be lesser than the `Size` encoded in the `Index`.
141-
</code></pre>
138+
<p>Converts an index to a safe integer value, for sized functor element access.</p>
139+
<p>The integer value will always be lesser than the <code>Size</code> encoded in the <code>Index</code>.</p>
142140

143141
</p>
144142
</div>

impl/vector.carp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
(fn [i]
2121
(Vector.nth &v i)))
2222

23-
(doc map "
24-
Maps a function `f` over all the elements of a Vector and returns a new
25-
Vector containing the results.")
23+
(doc map
24+
"Maps a function `f` over all the elements of a Vector and returns a new "
25+
"Vector containing the results.")
2626
(implements smap map)
2727
(sig map (Fn [(Ref (Fn [a] b)) (Ref (Vector (Size n) a))] (Vector (Size n) b)))
2828
(defn map [f v]

src/dimensional.carp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77
(definterface smap (Fn [(Ref (Fn [a] b)) (Ref (f s a))] (f s b)))
88

99
(defmodule Dimensional
10-
(doc tabulate "
11-
Tabulate maps a `lookup` function (any function that takes an `Index` as an
12-
argument) over the positions of a sized functor.
13-
14-
`(tabulate (lookup f))= (id f)`
15-
16-
To make this function useful, one often needs to use an overarching context
17-
to ensure the resulting functor is sized appropriately. ")
10+
(doc tabulate
11+
"Tabulate maps a `lookup` function (any function that takes an `Index` as an "
12+
"argument) over the positions of a sized functor."
13+
""
14+
"`(tabulate (lookup f))= (id f)`"
15+
""
16+
"To make this function useful, one often needs to use an overarching context "
17+
"to ensure the resulting functor is sized appropriately.")
1818
(defn tabulate [f]
1919
(smap f &(positions)))
2020

21-
(doc transpose "
22-
Transpose takes a sized functor whose inhabitants are sized functors and
23-
effectively swaps their sizes; it is equivalent to matrix transposition.
24-
25-
For example, given a Vector of Size 3 of Vectors of Size 2
26-
27-
`(Vector [(Vector [1 2]) (Vector [3 4]) (Vector [5 6])])`
28-
29-
transpose will return a Vector of size 2 of Vectors of size 3:
30-
31-
`(Vector [(Vector [1 3 5]) (Vector [2 4 6])])`")
21+
(doc transpose
22+
"Transpose takes a sized functor whose inhabitants are sized functors and "
23+
"effectively swaps their sizes; it is equivalent to matrix transposition."
24+
""
25+
"For example, given a Vector of Size 3 of Vectors of Size 2"
26+
""
27+
"`(Vector [(Vector [1 2]) (Vector [3 4]) (Vector [5 6])])`"
28+
""
29+
"transpose will return a Vector of size 2 of Vectors of size 3:"
30+
""
31+
"`(Vector [(Vector [1 3 5]) (Vector [2 4 6])])`")
3232
(sig transpose (Fn [(Ref (f (Size n) (g (Size m) a)))] (g (Size m) (f (Size n) a))))
3333
(defn transpose [f]
3434
(tabulate &(fn [i] (smap &(fn [x] ((lookup x) i)) f))))

0 commit comments

Comments
 (0)