1 /* -*-comment-start: "//";comment-end:""-*-
2 * Mes --- Maxwell Equations of Software
3 * Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
5 * This file is part of Mes.
7 * Mes is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
12 * Mes is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Mes. If not, see <http://www.gnu.org/licenses/>.
21 scm *caar (scm *x) {return car (car (x));}
22 scm *cadr (scm *x) {return car (cdr (x));}
23 scm *cdar (scm *x) {return cdr (car (x));}
24 scm *cddr (scm *x) {return cdr (cdr (x));}
25 scm *caaar (scm *x) {return car (car (car (x)));}
26 scm *caadr (scm *x) {return car (car (cdr (x)));}
27 scm *caddr (scm *x) {return car (cdr (cdr (x)));}
28 scm *cdadr (scm *x) {return cdr (car (cdr (x)));}
29 scm *cadar (scm *x) {return car (cdr (car (x)));}
30 scm *cddar (scm *x) {return cdr (cdr (car (x)));}
31 scm *cdddr (scm *x) {return cdr (cdr (cdr (x)));}
42 return make_number (n);
48 while (x != &scm_nil && cdr (x) != &scm_nil)
54 list (scm *x) ///((args . n))
60 vector_to_list (scm *v)
63 for (int i = 0; i < v->length; i++) {
64 scm *e = &v->vector[i];
65 if (e->type == REF) e = e->ref;
66 x = append2 (x, cons (e, &scm_nil));
72 integer_to_char (scm *x)
74 assert (x->type == NUMBER);
75 return make_char (x->value);
79 char_to_integer (scm *x)
81 assert (x->type == CHAR);
82 return make_number (x->value);
88 assert (x->type == NUMBER);