3 echo ' ()' | cat $($(dirname $0)/../scripts/include.mes $0) $0 /dev/stdin | $(dirname $0)/../scripts/mes "$@"
10 ;;; Mes --- Maxwell Equations of Software
11 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
13 ;;; This file is part of Mes.
15 ;;; Mes is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; Mes is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with Mes. If not, see <http://www.gnu.org/licenses/>.
28 (mes-use-module (mes base-0))
29 (mes-use-module (mes base))
30 (mes-use-module (mes quasiquote))
31 (mes-use-module (mes let))
32 (mes-use-module (srfi srfi-0))
33 (mes-use-module (mes scm))
34 (mes-use-module (mes psyntax-0))
35 (mes-use-module (mes psyntax-pp))
36 (mes-use-module (mes psyntax-1))
37 (mes-use-module (mes test))
39 (pass-if "first dummy" #t)
40 (pass-if-not "second dummy" #f)
44 ;;(use-modules (ice-9 syncase))
45 (define sc-expand identity)
46 (define syntax-object->datum syntax->datum)
47 (define datum->syntax-object datum->syntax)
53 (seq? (andmap (lambda (x) (> x 0)) '(3 2 1)) #t))
56 (seq? (andmap (lambda (x) (> x 0)) '(3 2 1 0)) #f))
58 (pass-if "putprop" (putprop 'foo '*sc-expander 'bar))
61 (seq? (getprop 'foo '*sc-expander) 'bar))
64 (pass-if "syntax-case"
65 (sequal? (let* ((sexp '(syntax-case '((1 2) (3 4)) ()
66 (((x ...) ...) (syntax (x ... ...)))))
67 (expanded (sc-expand sexp)))
68 (primitive-eval expanded))
73 (syntax-case '((1 2) (3 4)) ()
74 (((x ...) ...) (syntax (x ... ...)))))
77 (pass-if "syntax-object->datum"
78 (sequal? (syntax-object->datum (syntax (set! a b)))
81 (pass-if "syntax-case swap!"
82 (sequal? (syntax-object->datum
83 (let ((exp '(set! a b)))
90 '(let ((temp a)) (set! a b) (set! b temp))))
93 (pass-if "syntax-case manual swap!"
95 (let* ((sc (sc-expand '(syntax-case exp () ((swap! a b) (syntax (let ((temp a)) (set! a b) (set! b temp)))))))
99 (s (eval sc (current-module)))
100 (d (syntax-object->datum s)))
101 (eval d (current-module))
105 (pass-if "define-syntax swap! [syntax-case]"