=============arc (2008)============= version used Arc 3.1 version repl mzscheme -f as.scm arc.sh M-x run-arc shebang cell types case sensitive yes argument whitespace separator falsehoods nil () true, is true t, yes symbol? nil, is () null?, nil is () symbol? type-of type type predicates (is (type x) 'int) (is (type x) 'sym) etc. set property none get property none remove none property comment (+ 1 1) ; adding ============ten primitives========== atom (or list?) atom quote quote eq is car car cdr cdr cons cons cond (if (> x 0) 1 (is x 0) 0 -1) lambda (fn (x) (* x x)) [* _ _] label = apply ((fn (x) (* x x) 2) ([* _ _] 2) =============arithmetic============= ==============strings=============== ==========execution control========= =========functions and scope======== ==============lists================= list literal '(1 2 3) pair literal '(1 2) (car '()) nil (cdr '()) nil (eval '()) nil list functions list alist len append rev nth ('(0 1 2 3) 3) last butlast (last l) (firstn (- (length l) 1) l) sort (sort < '(3 2 1 0)) assoc (assoc 3 '((1 2) (3 4))) getf none map (map [* _ _] '(1 2 3)) filter (keep [* _ _] '(1 2 3)) reduce (reduce + '(1 2 3)) push and pop (= x '(1 2 3)) (push 4 x) (pop x) ============sequences=============== predicate alist ===========other containers========= =========i/o and environment======== format string (pr "Spain" 7 ": " 13.7) to stdout external (system "ls /etc") command open file (= in (infile "/etc/passwd")) read line (readline in) close file (close in) =======libraries and namespaces===== loading a file (load "a.arc") ============compilation============= ==============macros================ backquote and (def op +) comma (eval `(,op 1 1)) defmacro (mac rpn (arg1 arg2 op) (list op arg1 arg2)) defmacro w/ (mac rpn (arg1 arg2 op) backquote `(,op arg1 arg2)) recursive (macex '(rpn 1 2 +)) macroexpand single (macex1 '(rpn 1 2 +)) macroexpand splice quote (mac add (args) `(+ ,@args)) hygenic? no local values using gensym ==============classes=============== =============concurrency============ create thread (thread) ==========java interoperation======= version used jarc on jvm