Skip to content

Commit 7ffb978

Browse files
committed
fix errors in list docs
1 parent 1c1edea commit 7ffb978

File tree

9 files changed

+46
-85
lines changed

9 files changed

+46
-85
lines changed

_ref/list.tem

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
(def tuples "list [n]" "Splits <code>list</code> into groups of <code>n</code>. <code>tuples</code> is a generalization of <code>pair</code>." (tests (tuples '(1 2 3 4 5) 1) (tuples '(1 2 3 4 5)) (tuples '(1 2 3 4 5) 3)))
3535
(def join "[list ...]" "Joins lists into one list." (tests (join '(1 2) nil '(3 4))))
3636
(def list "[arg ...]" "Creates a list of the arguments." (tests (list 1 2 3) (list "a" '(1 2) 3)))
37-
(def copylist "[arg ...]" "Identical to list. New in arc3 and probably temporary." (tests (copylist 1 2 3) (copylist "a" '(1 2) 3)))
37+
(def copylist "args" "Identical to list." (tests (copylist '(1 2 3)) (copylist '("a" (1 2) 3))))
3838
(def range "start end" "Creates a list of numbers from start to end in steps of 1. The last number is <= end." (tests (range 0 10) (range 1.5 3.8)))
3939
(mac n-of "n expr" "Evaluates <code>expr</code> <code>n</code> times and returns a list of the results." (tests (n-of 5 "a") (w/instring ins "abcdefg" (n-of 5 (readc ins)))))
4040
(def adjoin "elt list [test]" "Cons <code>elt</code> onto <code>list</code> unless <code>(test elt y)</code> is true for some <code>y</code> in <code>list</code>. By default, <code>test</code> is <code>iso</code>, so <code>elt</code> will be joined if it is not present in <code>list</code>." (tests (adjoin 2 '(1 2 3)) (adjoin 2 '(1 3 5)) (adjoin 2 '(1 2 3) <) (adjoin 2 '(0 1 2) <)))
@@ -82,12 +82,11 @@
8282
(text "These operations act on lists, strings, or hash tables.")
8383
(op destructive sref "seq value index" "Sets indexed entry in a list, string, or hash table to
8484
the given value."
85-
(tests "(do
86-
(= x \"abc\")
85+
(tests "(let x (copy \"abc\") ; <span style='color:blue'>make the string literal mutable</span>
8786
(sref x #\\d 1) x)"
8887
"(do
8988
(= x '(1 2 3))
90-
(sref x #\\d 1) x)"))
89+
(sref x 4 1) x)"))
9190
(def count "test seq" "Counts the number of elements of <code>seq</code> that satisfy <code>test</code>. <code>test</code> is an object or predicate. For a table, the elements are the values." (tests (count #\a "banana") (count [odd _] '(1 2 3 4 5))) (count [odd _] (obj a 1 b 2 c 3)))
9291
(def union "f xs ys" "Takes union of sequence <code>xs</code> and <code>ys</code>. Predicate <code>f</code> is used to determine equality to filter out duplicates. <code>xs</code> and <code>ys</code> must both be lists or strings." (tests
9392
(union is '(1 2 3) '(2 3 4))
@@ -122,7 +121,7 @@ the sequences are identical." (tests (mismatch "abcde" "abXde") (mismatch '(1
122121
(map [list _ (* _ 10)] '(1 2 3)) (map cdr '((1) (2 3) (4 5)))
123122
(map (fn (c n) (coerce (+ n (coerce c 'int)) 'char)) "abc" '(0 2 4))
124123
(map min "bird" "elephant")))
125-
(def sum "f seq" "Applies f to the elements of the sequence and sums the results. New in arc3." (tests (sum int "abc") (sum log '(1 2 3)) (sum idfn (obj 'a 1 'b 2 'c 3))))
124+
(def sum "f seq" "Applies f to the elements of the sequence and sums the results. New in arc3." (tests (sum int "abc") (sum log '(1 2 3)) (sum cadr (obj a 1 b 2 c 3))))
126125

127126
(def get "index" "Generates a function to get the element referenced by index; the function can be applied to a table. This is useful for mapping, for instance. (It can also be applied to functions, not jus sequences.) New in arc3."
128127
(tests (map get.2 '((a b c) (1 2 3) (p q r))) (get!b (obj a 10 b 20)) (get.42 log)))

ref/app.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ <h2>Internals</h2>
581581
</td>
582582
<td class='arc'><pre>
583583
&gt;(cook-user "testuser")
584-
<span class="return">KUOpf1Nv
584+
<span class="return">vykMqKn4
585585
</span></pre>
586586
</td></tr>
587587
<tr>
@@ -592,7 +592,7 @@ <h2>Internals</h2>
592592
</td>
593593
<td class='arc'><pre>
594594
&gt;(new-user-cookie)
595-
<span class="return">isTRZEx8
595+
<span class="return">bm3DQFO1
596596
</span></pre>
597597
</td></tr>
598598
<tr>
@@ -614,7 +614,7 @@ <h2>Internals</h2>
614614
</td>
615615
<td class='arc'><pre>
616616
&gt;(disable-acct "badperson")
617-
<span class="return">((KUOpf1Nv "testuser"))
617+
<span class="return">((vykMqKn4 "testuser"))
618618
</span></pre>
619619
</td></tr>
620620
<tr>

ref/foundation-doc.html

-2 Bytes
Binary file not shown.

ref/list.html

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -326,36 +326,16 @@ <h2>List manipulation</h2>
326326
<tr>
327327
<td class='arc'><a name='copylist'></a>
328328
<img src='proc.gif' title='Procedure'/>
329-
<span class='op'>copylist</span> <span class='args'>[arg ...]</span>
330-
<div class='desc'>Identical to list. New in arc3 and probably temporary.</div>
331-
</td>
332-
<td class='arc'><pre>
333-
&gt;(copylist 1 2 3)
334-
<span class="stdout">Error: copylist: arity mismatch;
335-
the expected number of ar
336-
guments does not match the given number
337-
expected: 1
338-
give
339-
n: 3
340-
arguments...:
341-
1
342-
2
343-
3
344-
329+
<span class='op'>copylist</span> <span class='args'>args</span>
330+
<div class='desc'>Identical to list.</div>
331+
</td>
332+
<td class='arc'><pre>
333+
&gt;(copylist '(1 2 3))
334+
<span class="return">(1 2 3)
345335
</span></pre>
346336
<pre>
347-
&gt;(copylist "a" '(1 2) 3)
348-
<span class="stdout">Error: copylist: arity mismatch;
349-
the expected number of ar
350-
guments does not match the given number
351-
expected: 1
352-
give
353-
n: 3
354-
arguments...:
355-
"a"
356-
'(1 2 . nil)
357-
3
358-
337+
&gt;(copylist '("a" (1 2) 3))
338+
<span class="return">("a" (1 2) 3)
359339
</span></pre>
360340
</td></tr>
361341
<tr>
@@ -741,25 +721,15 @@ <h2>Sequence manipulation</h2>
741721
the given value.</div>
742722
</td>
743723
<td class='arc'><pre>
744-
&gt;(do
745-
(= x "abc")
724+
&gt;(let x (copy "abc") ; <span style='color:blue'>make the string literal mutable</span>
746725
(sref x #\d 1) x)
747-
<span class="stdout">Error: string-set!: contract violation
748-
expected: (and/c st
749-
ring? (not/c immutable?))
750-
given: "abc"
751-
argument position
752-
: 1st
753-
other arguments...:
754-
1
755-
#\d
756-
726+
<span class="return">"adc"
757727
</span></pre>
758728
<pre>
759729
&gt;(do
760730
(= x '(1 2 3))
761-
(sref x #\d 1) x)
762-
<span class="return">(1 #\d 3)
731+
(sref x 4 1) x)
732+
<span class="return">(1 4 3)
763733
</span></pre>
764734
</td></tr>
765735
<tr>
@@ -953,11 +923,11 @@ <h2>Sequence manipulation</h2>
953923
</td>
954924
<td class='arc'><pre>
955925
&gt;(rand-elt '(1 2 3))
956-
<span class="return">2
926+
<span class="return">1
957927
</span></pre>
958928
<pre>
959929
&gt;(rand-elt "abcd")
960-
<span class="return">#\a
930+
<span class="return">#\d
961931
</span></pre>
962932
</td></tr>
963933
<tr>
@@ -1112,16 +1082,8 @@ <h2>Sequence manipulation</h2>
11121082
<span class="return">1.791759469228055
11131083
</span></pre>
11141084
<pre>
1115-
&gt;(sum idfn (obj 'a 1 'b 2 'c 3))
1116-
<span class="stdout">Error: +: contract violation
1117-
expected: number?
1118-
given: '(
1119-
(quote b . nil) 2)
1120-
argument position: 2nd
1121-
other argument
1122-
s...:
1123-
0
1124-
1085+
&gt;(sum cadr (obj a 1 b 2 c 3))
1086+
<span class="return">6
11251087
</span></pre>
11261088
</td></tr>
11271089
<tr>
@@ -1154,7 +1116,7 @@ <h2>Other</h2>
11541116
</td>
11551117
<td class='arc'><pre>
11561118
&gt;(rand-choice "a" 42 '(1 2 3))
1157-
<span class="return">(1 2 3)
1119+
<span class="return">42
11581120
</span></pre>
11591121
</td></tr>
11601122
<tr>

ref/math.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ <h2>Math operations</h2>
141141
</td>
142142
<td class='arc'><pre>
143143
&gt;(rand 10)
144-
<span class="return">5
144+
<span class="return">0
145145
</span></pre>
146146
<pre>
147147
&gt;(rand)
148-
<span class="return">0.9008386175554323
148+
<span class="return">0.9109132116357676
149149
</span></pre>
150150
</td></tr>
151151
<tr>

ref/os.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h2>Other OS Operations</h2>
5555
</td>
5656
<td class='arc'><pre>
5757
&gt;(memory)
58-
<span class="return">30670696
58+
<span class="return">43475048
5959
</span></pre>
6060
</td></tr>
6161
<tr>
@@ -66,7 +66,7 @@ <h2>Other OS Operations</h2>
6666
</td>
6767
<td class='arc'><pre>
6868
&gt;(system "date")
69-
<span class="stdout">Wed Apr 30 18:22:33 GMT 2014
69+
<span class="stdout">Tue May 6 04:25:30 GMT 2014
7070

7171
</span><span class="return">nil
7272
</span></pre>

ref/srv.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ <h2>Web server</h2>
322322
</td>
323323
<td class='arc'><pre>
324324
&gt;(afnid (fn (req) (prn "\nFnid is " it)))
325-
<span class="return">X1KOo4LZyc
325+
<span class="return">scPB0WrZMF
326326
</span></pre>
327327
</td></tr>
328328
<tr>
@@ -333,7 +333,7 @@ <h2>Web server</h2>
333333
</td>
334334
<td class='arc'><pre>
335335
&gt;(flink (fn (req) (prn "hi")))
336-
<span class="return">"/x?fnid=GeGuR2r8nj"
336+
<span class="return">"/x?fnid=CbYEM2Ql3d"
337337
</span></pre>
338338
</td></tr>
339339
<tr>
@@ -344,7 +344,7 @@ <h2>Web server</h2>
344344
</td>
345345
<td class='arc'><pre>
346346
&gt;(rflink (fn (req) (prn "Header: x") "foo"))
347-
<span class="return">"/r?fnid=GbzuppNR8V"
347+
<span class="return">"/r?fnid=EuL1EaDuyB"
348348
</span></pre>
349349
</td></tr>
350350
<tr>
@@ -459,7 +459,7 @@ <h2>Web server</h2>
459459
<span class="stdout">Error: open-output-file: cannot open output file
460460
path: /ho
461461
me/agaram/Desktop/minilangs/arcsite/_ref/arc/logs/blog-2014-
462-
04-30
462+
05-06
463463
system error: No such file or directory; errno=2
464464

465465
</span></pre>
@@ -863,7 +863,7 @@ <h2>Web server internals</h2>
863863
</td>
864864
<td class='arc'><pre>
865865
&gt;(new-fnid)
866-
<span class="return">ioUAGxvFeM
866+
<span class="return">j9O30bqoYN
867867
</span></pre>
868868
</td></tr>
869869
<tr>
@@ -874,7 +874,7 @@ <h2>Web server internals</h2>
874874
</td>
875875
<td class='arc'><pre>
876876
&gt;(fnid (fn (req) (prn "hi")))
877-
<span class="return">Uc6eAazDMQ
877+
<span class="return">Jb9iQrfNkN
878878
</span></pre>
879879
</td></tr>
880880
<tr>
@@ -885,7 +885,7 @@ <h2>Web server internals</h2>
885885
</td>
886886
<td class='arc'><pre>
887887
&gt;(timed-fnid 100 (fn (req) (prn "hi")))
888-
<span class="return">5Lyv6Pa5Js
888+
<span class="return">O5dbJyPdLZ
889889
</span></pre>
890890
</td></tr>
891891
<tr>
@@ -918,7 +918,7 @@ <h2>Web server internals</h2>
918918
</td>
919919
<td class='arc'><pre>
920920
&gt;(unique-id)
921-
<span class="return">uiRnPsqj
921+
<span class="return">mhcnQO5y
922922
</span></pre>
923923
</td></tr>
924924
<tr>
@@ -1037,7 +1037,7 @@ <h2>Web server internals</h2>
10371037
</td>
10381038
<td class='arc'><pre>
10391039
&gt;(keys redirector*)
1040-
<span class="return">(baz bar y r)
1040+
<span class="return">(y baz bar r)
10411041
</span></pre>
10421042
</td></tr>
10431043
<tr>
@@ -1178,7 +1178,7 @@ <h2>Web server internals</h2>
11781178
</td>
11791179
<td class='arc'><pre>
11801180
&gt;(logfile-name "gif")
1181-
<span class="return">"arc/logs/gif-2014-04-30"
1181+
<span class="return">"arc/logs/gif-2014-05-06"
11821182
</span></pre>
11831183
</td></tr>
11841184
<tr>

ref/string.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ <h2>String operations</h2>
177177
</td>
178178
<td class='arc'><pre>
179179
&gt;(rand-string 10)
180-
<span class="return">"KG3PEhoTBw"
180+
<span class="return">"Srs5yRCYrF"
181181
</span></pre>
182182
</td></tr>
183183
<tr>

ref/time.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h2>Time</h2>
6363
</td>
6464
<td class='arc'><pre>
6565
&gt;(seconds)
66-
<span class="return">1398882156
66+
<span class="return">1399350332
6767
</span></pre>
6868
</td></tr>
6969
<tr>
@@ -75,7 +75,7 @@ <h2>Time</h2>
7575
</td>
7676
<td class='arc'><pre>
7777
&gt;(msec)
78-
<span class="return">1398882156483
78+
<span class="return">1399350332849
7979
</span></pre>
8080
</td></tr>
8181
<tr>
@@ -86,7 +86,7 @@ <h2>Time</h2>
8686
</td>
8787
<td class='arc'><pre>
8888
&gt;(timedate)
89-
<span class="return">(36 22 18 30 4 2014)
89+
<span class="return">(32 25 4 6 5 2014)
9090
</span></pre>
9191
<pre>
9292
&gt;(timedate 0)
@@ -102,7 +102,7 @@ <h2>Time</h2>
102102
</td>
103103
<td class='arc'><pre>
104104
&gt;(current-gc-milliseconds)
105-
<span class="return">164
105+
<span class="return">162
106106
</span></pre>
107107
</td></tr>
108108
<tr>
@@ -114,7 +114,7 @@ <h2>Time</h2>
114114
</td>
115115
<td class='arc'><pre>
116116
&gt;(current-process-milliseconds)
117-
<span class="return">1840
117+
<span class="return">1780
118118
</span></pre>
119119
</td></tr>
120120
<tr>
@@ -169,7 +169,7 @@ <h2>Time</h2>
169169
</td>
170170
<td class='arc'><pre>
171171
&gt;(datestring)
172-
<span class="return">"2014-04-30"
172+
<span class="return">"2014-05-06"
173173
</span></pre>
174174
<pre>
175175
&gt;(datestring 0)
@@ -213,7 +213,7 @@ <h2>Timing</h2>
213213
</td>
214214
<td class='arc'><pre>
215215
&gt;(time10 (sleep 0.1))
216-
<span class="stdout">time: 1001 msec.
216+
<span class="stdout">time: 1000 msec.
217217

218218
</span><span class="return">nil
219219
</span></pre>

0 commit comments

Comments
 (0)