$ mzscheme -f as.scm
Use (quit) to quit, (tl) to return here after an interrupt.
arc> $$x
Error: "list->string: expects argument of type <list of character>; given #\\$"
arc> (= tbl (table))
#hash()
arc> (= tbl$x '(1 2 3))
Error: "reference to undefined identifier: _x"
arc> (= x "key")
"key"
arc> (= tbl$x '(1 2 3))
(1 2 3)
arc> tbl
#hash((key . (1 2 3 . nil)))
arc> tbl$x
(1 2 3)
arc> tbl$x.0
1
arc> (tbl 'x)
nil
arc> (tbl 'key)
(1 2 3)
arc> $x
key
arc> $x$y
Error: "reference to undefined identifier: _y"
arc> (= y "abc")
"abc"
arc> $x$y
Error: "Function call on inappropriate object key (abc)"
arc> :a
$ mzscheme -i -f as.scm
Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
Use (quit) to quit, (tl) to return here after an interrupt.
arc> :a
> (ac '$x$y '())
(ar-funcall1 (ar-funcall1 _sym (ar-funcall1 _sym _x)) (ar-funcall1 _sym _y)) ; buggy?
Scheme syntax isn't all that different from Arc syntax. The main differences you see in this example are:
- Instead of
(def f (x) body)
in Scheme it's
(define (f x) body)
- Different names: Arc is = Scheme eqv?, Arc t & nil = Scheme #t & #f, Arc fn = Scheme lambda, etc.
- Scheme's cond is like Arc's if, but with extra parentheses.
; Arc
(if a b
c d
e)
; Scheme
(cond (a b)
(c d)
(#t e))
- You have access to a different set of library functions than the ones Arc provides. Most of what you need is defined in ac.scm. If you're unsure how it works, puzzle at the definition some.