3 ;;; GNU Mes --- Maxwell Equations of Software
4 ;;; Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 ;;; This file is part of GNU Mes.
8 ;;; GNU Mes is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Mes is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (mes guile)
51 ;;#:re-export (open-input-file open-input-string with-input-from-string)
56 (define pmatch-car car)
57 (define pmatch-cdr cdr)
58 (define core:exit exit)
59 (define core:display display)
60 (define core:display-port display)
61 (define (core:display-error o) (display o (current-error-port)))
62 (define core:write write)
63 (define (core:write-error o) (write o (current-error-port)))
64 (define core:write-port write)
65 (define core:macro-expand identity)
66 (define (core:apply f a . m) (apply f a))
67 (define (core:car f a . m) (apply f a))
68 (define append2 append)
70 (define guile:keyword? keyword?)
71 (define guile:number? number?)
72 (define guile:pair? pair?)
73 (define guile:string? string?)
74 (define guile:symbol? symbol?)
76 (define <cell:char> 0)
77 (define <cell:keyword> 4)
78 (define <cell:number> 6)
79 (define <cell:pair> 7)
80 (define <cell:string> 10)
81 (define <cell:symbol> 11)
82 (define <cell:vector> 15)
85 (cond ((guile:keyword? x) <cell:keyword>)
86 ((guile:number? x) <cell:number>)
87 ((guile:pair? x) <cell:pair>)
88 ((guile:string? x) <cell:string>)
89 ((guile:symbol? x) <cell:symbol>)))
91 (cond ((guile:string? x) (string->list x))))
92 (define (core:make-cell type car cdr)
93 (cond ((eq? type <cell:string>) (list->string car)))))
100 (use-modules (ice-9 syncase))
101 (define (compose proc . rest)
102 (if (null? rest) proc
104 (proc (apply (apply compose rest) args)))))