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
6 changes: 3 additions & 3 deletions _ref/app.tem
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

(mac defopl "name parm [body]" "Version of <code>defop</code> to create handler that will redirect to login page if the user is not logged in." (faketest "(defopl foo req (prn \"Welcome!\"))" ""))

(mac uform "user req after [body ...]" "Generates form that ensures it was submitted by <code>user</code> (by using <code>when-umatch</code>). <code>body</code> outputs the form body to stdout. After submission, the continuation code <code>after</code> is executed; <code>req</code> specifies the varible name in <code>after</code> to receive the request."
(mac uform "user req after [body ...]" "Generates form that ensures it was submitted by <code>user</code> (by using <code>when-umatch</code>). <code>body</code> outputs the form body to stdout. After submission, the continuation code <code>after</code> is executed; <code>req</code> specifies the variable name in <code>after</code> to receive the request."
(faketest "(uform user req (prn \"Result\") (prn \"The form\") (submit))" ""))

(mac urform "user req after [body ...]" "Generates form with redirection target with guard that <code>user</code> submitted it. After submission, the continuation expression <code>after</code> is executed and must return the redirect string; <code>req</code> specifies the varible name in <code>after</code> to receive the request." (faketest "(urform user req \"newpage\" (prn \"Form\") (submit))" ""))
(mac urform "user req after [body ...]" "Generates form with redirection target with guard that <code>user</code> submitted it. After submission, the continuation expression <code>after</code> is executed and must return the redirect string; <code>req</code> specifies the variable name in <code>after</code> to receive the request." (faketest "(urform user req \"newpage\" (prn \"Form\") (submit))" ""))

(mac when-umatch "user req [body...]" "If <code>user</code> matches the user associated with <code>req</code>, executes <code>body</code>. Otherwise executes <code>mismatch-message</code>."
(faketest "(defopl ul req (let user (get-user req)
Expand Down Expand Up @@ -121,7 +121,7 @@
(def varfield "typ id val" "Prints HTML for an input field of type <code>typ</code>, name <code>id</code>, and value <code>val</code>. <code>typ</code> is one of
<code>bigtoks</code>, <code>date</code>, <code>doc</code>, <code>int</code>, <code>lines</code>, <code>mdtext</code>, <code>mdtext2</code>, <code>num</code>, <code>posint</code>, <code>string</code>, <code>string1</code>, <code>sym</code>, <code>syms</code>, <code>text</code>, <code>time</code>, <code>toks</code>, <code>url</code>, <code>users</code>. The type of field and the processing of val depend on <code>typ</code>." (htmltests (show varfield 'syms 'foo '(a b c))))

(def text-rows "text width [pad]" "Detemines how many rows to hold <code>text</code> based on <code>width</code> and padding." (tests (text-rows "abcde" 2)))
(def text-rows "text width [pad]" "Determines how many rows to hold <code>text</code> based on <code>width</code> and padding." (tests (text-rows "abcde" 2)))

(def needrows "text cols [pad]" "Determines how many rows are needed to hold <code>text</code>, based on the length of the text and the number of newlines." (tests (needrows "abcde" 2)))

Expand Down
2 changes: 1 addition & 1 deletion _ref/arc/ac.scm
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@

(define fn-signatures (make-hash-table 'equal))

; This is a replacement for xdef that stores opeator signatures.
; This is a replacement for xdef that stores operator signatures.
; Haven't started using it yet.

(define (odef a parms b)
Expand Down
2 changes: 1 addition & 1 deletion _ref/arc/app.arc
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@

; (= fail* (uniq))

(def fail* ()) ; coudn't possibly come back from a form
(def fail* ()) ; couldn't possibly come back from a form

; Takes a list of fields of the form (type label value view modify) and
; a fn f and generates a form such that when submitted (f label newval)
Expand Down
2 changes: 1 addition & 1 deletion _ref/arc/brackets.scm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

; main reader function for []s
; recursive read starts with default readtable's [ parser,
; but nested reads still use the curent readtable:
; but nested reads still use the current readtable:

(define (read-square-brackets ch port src line col pos)
`(fn (_)
Expand Down
2 changes: 1 addition & 1 deletion _ref/arc/news.arc
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ function vote(node) {
(def commentable (i) (in i!type 'story 'comment 'poll))

; By default the ability to comment on an item is turned off after
; 45 days, but this can be overriden with commentable key.
; 45 days, but this can be overridden with commentable key.

(= commentable-threshold* (* 60 24 45))

Expand Down
2 changes: 1 addition & 1 deletion _ref/docs/assign.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Assignment primitives</h2>
</pre>
Unusual list structures, including cyclic lists, can be created by splicing lists together with <code>scar</code> or <code>scdr</code>. Arc currently hangs if a cyclic list is displayed, so be forewarned.
<h2>Places and =</h2>
Generallly, assignment in Arc is performed with the <code>=</code> macro.
Generally, assignment in Arc is performed with the <code>=</code> macro.
It is similar to <code>set</code>, except it allows assignment not only to a symbol, but also to a "place".
Roughly speaking, a place is a location that can be updated.
The place can be a symbol, an index into a table, a character in a string, an index into a list, or a complex location in a list. The following examples illustrate how these different places can be updated.
Expand Down
4 changes: 2 additions & 2 deletions _ref/docs/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2>How macros work</h2>
</pre>
The macro foo does two things: it prints "macro executed" when it is executed during macroexpansion, and it returns the list: <code>(prn "generated code executed")</code>. When that list is executed in evaluation, it will display "generated code executed". (Since <code>prn</code> returns that string, the string is also displayed a second time as the result of the command.)
<p>
Howerver, the two phases of macroexpansion and evaluation can be separated in time.
However, the two phases of macroexpansion and evaluation can be separated in time.
If we use the macro inside a function definition, things get interesting:
<pre class="repl">
arc> (def bar () (prn "bar executed") (foo))
Expand Down Expand Up @@ -117,7 +117,7 @@ <h2>Macroexpansion</h2>
Comparing <code>ac-mac-call</code> to <code>ac-call</code> shows why macros receive their arguments unevaluated. <code>ac-mac-call</code> applies the macro function to the arguments, while <code>ac-call</code> maps <code>ac</code> on the arguments before applying the function, causing the arguments to be evaluated.

<h2>Evaluation</h2>
Nothing partcularly special happens for macro code during evaluation. At this point it is Scheme code, and it gets executed the same as any other code. Specifically, <code>arc-eval</code> calls <code>eval</code> on the Scheme code generated by <code>ac</code>. It may use <code>ar-funcall<i>n</i></code> to execute functions, and execution will typically bottom-out with foundation operations implemented in native Scheme. (See <a href="http://arcfn.com/foundation-doc.html">Arc Foundation Documentation</a> for details.)
Nothing particularly special happens for macro code during evaluation. At this point it is Scheme code, and it gets executed the same as any other code. Specifically, <code>arc-eval</code> calls <code>eval</code> on the Scheme code generated by <code>ac</code>. It may use <code>ar-funcall<i>n</i></code> to execute functions, and execution will typically bottom-out with foundation operations implemented in native Scheme. (See <a href="http://arcfn.com/foundation-doc.html">Arc Foundation Documentation</a> for details.)

<h2>macex and macex1</h2>
The <code>macex</code> and <code>macex1</code> functions perform macro expansion. If the outermost form is a macro, <code>macex1</code> expands it once, while <code>macex</code> expands it repeatedly until it is no longer a macro. These functions are typically used for debugging, to see what a macros is doing. Note that neither <code>macex</code> nor <code>macex1</code> expand inner macros.
Expand Down
2 changes: 1 addition & 1 deletion _ref/io.tem
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
)

(newtable "Disk variables"
(mac diskvar "var file" "Creates a variable that will be loaded from file and stored in file. If file exists, var is initialzed from file. New in arc3." (tests (diskvar foo "file.txt")))
(mac diskvar "var file" "Creates a variable that will be loaded from file and stored in file. If file exists, var is initialized from file. New in arc3." (tests (diskvar foo "file.txt")))
(mac disktable "var file" "Creates a table variable that will be loaded from file and stored in file. New in arc3." (tests (disktable bar "file.txt")))
(mac todisk "var [expr]" "Writes var to disk, optionally setting it to expr first. New in arc3." (tests (todisk bar)))
(mac fromdisk "var file init load save" "If var is not bound, var is initialized either by calling load function on file or using init. The save function is saved for later use. Internal function. New in arc3.")
Expand Down
2 changes: 1 addition & 1 deletion _ref/setforms.tem
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(var setter "" (tests))
(mac destructive defset "name parms [body ...]" "Defines a new type of place. Creates a new <code>setforms</code> handler for the function of the specified name." (tests (defset foo (x) nil)))
(def predicate metafn "x" "Helper predicate for setforms. Tests if x is a meta function: that is, it has special syntax, or uses compose or complement." (tests '(metafn '(a:b))))
(def expand-metafn-call "f args" "Helper for setforms. Take a function of the form (compose ...) and expands it into the approprate composed function calls.." (tests "(expand-metafn-call '(compose g h) '(a b))"
(def expand-metafn-call "f args" "Helper for setforms. Take a function of the form (compose ...) and expands it into the appropriate composed function calls.." (tests "(expand-metafn-call '(compose g h) '(a b))"
))
(def expand= "place val" "Helper for =. Generates code to assign val to place." (tests (expand= 'a 42)))
(def expand=list "terms" "Helper for =. Pairs up the arguments to =, and calls expand= on each pair." (tests (expand=list '(a 42 b 43))))
Expand Down
2 changes: 1 addition & 1 deletion _ref/string.tem
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(def predicate nonwhite "c" "Predicate to test if a character is not whitespace (space, newline, tab, or return)." (tests (nonwhite #\tab) (nonwhite #\a)))
(def predicate letter "c" "Predicate to test if a character is alphabetic. New in arc3." (tests (letter #\A) (letter #\2)))
(def predicate alphadig "c" "Predicate to test if a character is alphabetic or a digit." (tests (alphadig #\A) (alphadig #\2)))
(def predicate punc "c" "Predicate to detemine if c is a punctuation character in the set: .,;:!?" (tests (punc #\.) (punc #\a) (punc ".")))
(def predicate punc "c" "Predicate to determine if c is a punctuation character in the set: .,;:!?" (tests (punc #\.) (punc #\a) (punc ".")))
(def downcase "str" "Converts a string, character, or symbol to lower case. This only converts ASCII; Unicode is unchanged." (tests (downcase "abcDEF123") (downcase #\A) (downcase 'abcDEF123)))
(def upcase "str" "Converts a string, character, or symbol to lower case. This only converts ASCII; Unicode is unchanged." (tests (upcase "abcDEF123") (upcase #\a) (upcase 'abcDEF123)))

Expand Down
6 changes: 3 additions & 3 deletions ref/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h2>User management</h2>
<td class='arc'><a name='uform'></a>
<img src='macro.gif' title='Macro'/>
<span class='op'>uform</span> <span class='args'>user req after [body ...]</span>
<div class='desc'>Generates form that ensures it was submitted by <code>user</code> (by using <code>when-umatch</code>). <code>body</code> outputs the form body to stdout. After submission, the continuation code <code>after</code> is executed; <code>req</code> specifies the varible name in <code>after</code> to receive the request.</div>
<div class='desc'>Generates form that ensures it was submitted by <code>user</code> (by using <code>when-umatch</code>). <code>body</code> outputs the form body to stdout. After submission, the continuation code <code>after</code> is executed; <code>req</code> specifies the variable name in <code>after</code> to receive the request.</div>
</td>
<td class='arc'><pre>
&gt;(uform user req (prn "Result") (prn "The form") (submit))
Expand All @@ -223,7 +223,7 @@ <h2>User management</h2>
<td class='arc'><a name='urform'></a>
<img src='macro.gif' title='Macro'/>
<span class='op'>urform</span> <span class='args'>user req after [body ...]</span>
<div class='desc'>Generates form with redirection target with guard that <code>user</code> submitted it. After submission, the continuation expression <code>after</code> is executed and must return the redirect string; <code>req</code> specifies the varible name in <code>after</code> to receive the request.</div>
<div class='desc'>Generates form with redirection target with guard that <code>user</code> submitted it. After submission, the continuation expression <code>after</code> is executed and must return the redirect string; <code>req</code> specifies the variable name in <code>after</code> to receive the request.</div>
</td>
<td class='arc'><pre>
&gt;(urform user req "newpage" (prn "Form") (submit))
Expand Down Expand Up @@ -712,7 +712,7 @@ <h2>Internals</h2>
<td class='arc'><a name='text-rows'></a>
<img src='proc.gif' title='Procedure'/>
<span class='op'>text-rows</span> <span class='args'>text width [pad]</span>
<div class='desc'>Detemines how many rows to hold <code>text</code> based on <code>width</code> and padding.</div>
<div class='desc'>Determines how many rows to hold <code>text</code> based on <code>width</code> and padding.</div>
</td>
<td class='arc'><pre>
&gt;(text-rows "abcde" 2)
Expand Down
2 changes: 1 addition & 1 deletion ref/assign.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Assignment primitives</h2>
</pre>
Unusual list structures, including cyclic lists, can be created by splicing lists together with <code>scar</code> or <code>scdr</code>. Arc currently hangs if a cyclic list is displayed, so be forewarned.
<h2>Places and =</h2>
Generallly, assignment in Arc is performed with the <code>=</code> macro.
Generally, assignment in Arc is performed with the <code>=</code> macro.
It is similar to <code>set</code>, except it allows assignment not only to a symbol, but also to a "place".
Roughly speaking, a place is a location that can be updated.
The place can be a symbol, an index into a table, a character in a string, an index into a list, or a complex location in a list. The following examples illustrate how these different places can be updated.
Expand Down
2 changes: 1 addition & 1 deletion ref/assignment.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h2>Assignment primitives</h2>
</pre>
Unusual list structures, including cyclic lists, can be created by splicing lists together with <code>scar</code> or <code>scdr</code>. Arc currently hangs if a cyclic list is displayed, so be forewarned.
<h2>Places and =</h2>
Generallly, assignment in Arc is performed with the <code>=</code> macro.
Generally, assignment in Arc is performed with the <code>=</code> macro.
It is similar to <code>set</code>, except it allows assignment not only to a symbol, but also to a "place".
Roughly speaking, a place is a location that can be updated.
The place can be a symbol, an index into a table, a character in a string, an index into a list, or a complex location in a list. The following examples illustrate how these different places can be updated.
Expand Down
Binary file modified ref/foundation-doc.html
Binary file not shown.
2 changes: 1 addition & 1 deletion ref/io.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ <h2>Disk variables</h2>
<td class='arc'><a name='diskvar'></a>
<img src='macro.gif' title='Macro'/>
<span class='op'>diskvar</span> <span class='args'>var file</span>
<div class='desc'>Creates a variable that will be loaded from file and stored in file. If file exists, var is initialzed from file. New in arc3.</div>
<div class='desc'>Creates a variable that will be loaded from file and stored in file. If file exists, var is initialized from file. New in arc3.</div>
</td>
<td class='arc'><pre>
&gt;(diskvar foo "file.txt")
Expand Down
4 changes: 2 additions & 2 deletions ref/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2>How macros work</h2>
</pre>
The macro foo does two things: it prints "macro executed" when it is executed during macroexpansion, and it returns the list: <code>(prn "generated code executed")</code>. When that list is executed in evaluation, it will display "generated code executed". (Since <code>prn</code> returns that string, the string is also displayed a second time as the result of the command.)
<p>
Howerver, the two phases of macroexpansion and evaluation can be separated in time.
However, the two phases of macroexpansion and evaluation can be separated in time.
If we use the macro inside a function definition, things get interesting:
<pre class="repl">
arc> (def bar () (prn "bar executed") (foo))
Expand Down Expand Up @@ -117,7 +117,7 @@ <h2>Macroexpansion</h2>
Comparing <code>ac-mac-call</code> to <code>ac-call</code> shows why macros receive their arguments unevaluated. <code>ac-mac-call</code> applies the macro function to the arguments, while <code>ac-call</code> maps <code>ac</code> on the arguments before applying the function, causing the arguments to be evaluated.

<h2>Evaluation</h2>
Nothing partcularly special happens for macro code during evaluation. At this point it is Scheme code, and it gets executed the same as any other code. Specifically, <code>arc-eval</code> calls <code>eval</code> on the Scheme code generated by <code>ac</code>. It may use <code>ar-funcall<i>n</i></code> to execute functions, and execution will typically bottom-out with foundation operations implemented in native Scheme. (See <a href="http://arcfn.com/foundation-doc.html">Arc Foundation Documentation</a> for details.)
Nothing particularly special happens for macro code during evaluation. At this point it is Scheme code, and it gets executed the same as any other code. Specifically, <code>arc-eval</code> calls <code>eval</code> on the Scheme code generated by <code>ac</code>. It may use <code>ar-funcall<i>n</i></code> to execute functions, and execution will typically bottom-out with foundation operations implemented in native Scheme. (See <a href="http://arcfn.com/foundation-doc.html">Arc Foundation Documentation</a> for details.)

<h2>macex and macex1</h2>
The <code>macex</code> and <code>macex1</code> functions perform macro expansion. If the outermost form is a macro, <code>macex1</code> expands it once, while <code>macex</code> expands it repeatedly until it is no longer a macro. These functions are typically used for debugging, to see what a macros is doing. Note that neither <code>macex</code> nor <code>macex1</code> expand inner macros.
Expand Down
2 changes: 1 addition & 1 deletion ref/setforms.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ <h2>Operations to support places</h2>
<td class='arc'><a name='expand-metafn-call'></a>
<img src='proc.gif' title='Procedure'/>
<span class='op'>expand-metafn-call</span> <span class='args'>f args</span>
<div class='desc'>Helper for setforms. Take a function of the form (compose ...) and expands it into the approprate composed function calls..</div>
<div class='desc'>Helper for setforms. Take a function of the form (compose ...) and expands it into the appropriate composed function calls..</div>
</td>
<td class='arc'><pre>
&gt;(expand-metafn-call '(compose g h) '(a b))
Expand Down
2 changes: 1 addition & 1 deletion ref/string.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h2>String operations</h2>
<img src='proc.gif' title='Procedure'/>
<img src='predicate.gif' title='Predicate'/>
<span class='op'>punc</span> <span class='args'>c</span>
<div class='desc'>Predicate to detemine if c is a punctuation character in the set: .,;:!?</div>
<div class='desc'>Predicate to determine if c is a punctuation character in the set: .,;:!?</div>
</td>
<td class='arc'><pre>
&gt;(punc #\.)
Expand Down