Allows easy access to the underlying MzScheme language that Arc is written in.
diff --git a/ac.scm b/ac.scm index b16531f..fd1d0d4 100644 --- a/ac.scm +++ b/ac.scm @@ -61,6 +61,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) 'mz) (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))
This hack introduces an “mz
” syntax form into Arc. The argument to mz
is passed through unchanged to MzScheme when the Arc expression is compiled into MzScheme. For example, to call the MzScheme procedure “current-seconds
”, you can say:
arc> (mz (current-seconds)) 1233715389
With Arc’s colon syntax, this can also be written as:
arc> (mz:current-seconds) 1233715437
I chose to call the syntax “mz
” so that visually, “mz:current-seconds
” looks like “call MzScheme’s current-seconds
procedure”.
Note however, that by itself mz
does not convert between MzScheme and Arc data types. For example, if an MzScheme procedure returns a boolean, you’ll get an MzScheme #t
or #f
boolean, not an Arc t
or nil
boolean.
arc> (mz:port? 4) #f
By using git or patch, you can incorporate this patch into your version of Arc.
$ git pull git://github.com/CatDancer/arc.git tag arc2.mz0
For example,
$ mkdir arc $ cd arc $ git init $ git pull git://github.com/CatDancer/arc.git tag arc2.mz0
To apply this patch to your copy of arc using the patch command, download arc2.mz0.patch into your Arc directory, and at the Unix command line inside the Arc directory, type:
patch <arc2.mz0.patch
“patch
” is a standard utility that comes with Unix. (If you’re running Windows, iirc patch
comes with cygwin).
For example,
$ wget http://ycombinator.com/arc/arc2.tar [... downloading ...] $ tar xf arc2.tar $ cd arc2 $ patch <arc2.mz0.patch patching [...] $
The original Arc source is copyrighted by Paul Graham and Robert Morris and licensed under the Perl Foundations's Artistic License 2.0 as described in the “copyright” file in the Arc distribution.
My changes to Arc (this patch that I wrote) are in the public domain.
The combination of the original Arc and my changes together (what you get after you apply my patch) is also licensed under the Perl Foundations's Artistic License 2.0.