Superseded by scheme0.
ac0.patch
diff --git a/ac.scm b/ac.scm index 791a4ca..3f1663b 100644 --- a/ac.scm +++ b/ac.scm @@ -22,6 +22,7 @@ ((ssyntax? s) (ac (expand-ssyntax s) env)) ((symbol? s) (ac-var-ref s env)) ((ssyntax? (xcar s)) (ac (cons (expand-ssyntax (car s)) (cdr s)) env)) + ((eq? (xcar s) 'ac-scheme) (cadr s)) ((eq? (xcar s) 'quote) (list 'quote (ac-niltree (cadr s)))) ((eq? (xcar s) 'quasiquote) (ac-qq (cadr s) env)) ((eq? (xcar s) 'if) (ac-if (cdr s) env))
ac1.arc
(= ac-denil (ac-scheme ac-denil)) (= ac-global-name (ac-scheme ac-global-name)) (= ac-niltree (ac-scheme ac-niltree)) ; for when we can't use assign (mac ac-set-global (name val) (w/uniq (gname v) `(with (,gname (ac-global-name ,name) ,v ,val) (ac-scheme (namespace-set-variable-value! ,gname ,v)) nil))) (= scheme-f (read "#f")) (= scheme-t (read "#t"))
The ac-scheme
syntax quotes an expression, protecting it from being compiled by the Arc compiler. The expression is passed through unchanged to the MzScheme language that Arc is written in, and thus is interpreted as an MzScheme expression by MzScheme.
arc> (ac-scheme (let ((a 3)) (+ a 20))) 23
What works and doesn’t work inside an ac-scheme
expression is highly dependent on the precise details of how Arc code is compiled into Scheme code. For example, the arc3 compiler happens to compile an Arc lexical scope into an MzScheme lexical scope, and keeps the same variable names:
arc> (let a 4 (ac-scheme (* 2 a))) 8
but this could completely change in another release of Arc.
An Arc macro can expand into an ac-scheme
form, and so can generate the Scheme code which is tunneled through the Arc compiler.
ac-global-name
takes an Arc global variable name, and returns the name of the global variable inside of MzScheme.
Converts an Arc list into an MzScheme list by converting the trailing nil
into an MzScheme '()
.
The reverse of ac-denil
: converts an MzScheme list into an Arc list by changing MzScheme '()
into Arc’s nil
.
Sets the Arc global variable name
to value
. Useful when we need to bypass assign
.
The Scheme true and false values, #t and #f.
scheme0, the latest version of this hack.
Download ac0.patch and ac1.arc, or use the hackinator:
$ hack \ ycombinator.com/arc/arc3.1.tar \ awwx.ws/ac0.patch \ awwx.ws/ac1.arc
This patch is in the public domain. The combination of this patch and Arc may be redistributed or modified under the same terms as Arc itself.