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)
54 ;;#:re-export (open-input-file open-input-string with-input-from-string)
59 (define pmatch-car car)
60 (define pmatch-cdr cdr)
61 (define core:exit exit)
62 (define core:display display)
63 (define core:display-port display)
64 (define (core:display-error o) (display o (current-error-port)))
65 (define core:write write)
66 (define (core:write-error o) (write o (current-error-port)))
67 (define core:write-port write)
68 (define core:macro-expand identity)
69 (define (core:apply f a . m) (apply f a))
70 (define (core:car f a . m) (apply f a))
71 (define append2 append)
72 (define equal2? equal?)
74 (define guile:keyword? keyword?)
75 (define guile:number? number?)
76 (define guile:pair? pair?)
77 (define guile:string? string?)
78 (define guile:symbol? symbol?)
80 (define <cell:char> 0)
81 (define <cell:keyword> 4)
82 (define <cell:number> 6)
83 (define <cell:pair> 7)
84 (define <cell:string> 10)
85 (define <cell:symbol> 11)
86 (define <cell:vector> 15)
88 (define %compiler "gnuc")
89 (define keyword->string (compose symbol->string keyword->symbol))
92 (cond ((guile:keyword? x) <cell:keyword>)
93 ((guile:number? x) <cell:number>)
94 ((guile:pair? x) <cell:pair>)
95 ((guile:string? x) <cell:string>)
96 ((guile:symbol? x) <cell:symbol>)))
98 (cond ((guile:string? x) (string->list x))))
99 (define (core:make-cell type car cdr)
100 (cond ((eq? type <cell:string>) (list->string car)))))
107 (use-modules (ice-9 syncase))
108 (define (compose proc . rest)
109 (if (null? rest) proc
111 (proc (apply (apply compose rest) args)))))