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 // (setq comment-start "//")
22 // (setq comment-end "")
24 * The Maxwell Equations of Software -- John McCarthy page 13
25 * http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
45 enum type {CHAR, NUMBER, PAIR, STRING, SYMBOL, VALUES, VECTOR,
46 FUNCTION0, FUNCTION1, FUNCTION2, FUNCTION3, FUNCTIONn};
48 typedef struct scm_t* (*function0_t) (void);
49 typedef struct scm_t* (*function1_t) (struct scm_t*);
50 typedef struct scm_t* (*function2_t) (struct scm_t*, struct scm_t*);
51 typedef struct scm_t* (*function3_t) (struct scm_t*, struct scm_t*, struct scm_t*);
52 typedef struct scm_t* (*functionn_t) (struct scm_t*);
54 typedef struct scm_t {
63 function0_t function0;
64 function1_t function1;
65 function2_t function2;
66 function3_t function3;
67 functionn_t functionn;
69 struct scm_t** vector;
76 scm *display_helper (scm*, bool, char*, bool);
78 symbol_eq (scm *x, char *s)
80 return x->type == SYMBOL && !strcmp (x->name, s);
83 scm scm_nil = {SYMBOL, "()"};
84 scm scm_dot = {SYMBOL, "."};
85 scm scm_t = {SYMBOL, "#t"};
86 scm scm_f = {SYMBOL, "#f"};
87 scm scm_lambda = {SYMBOL, "lambda"};
88 scm scm_label = {SYMBOL, "label"};
89 scm scm_unspecified = {SYMBOL, "*unspecified*"};
90 scm scm_symbol_cond = {SYMBOL, "cond"};
91 scm scm_symbol_quote = {SYMBOL, "quote"};
93 scm scm_symbol_quasiquote = {SYMBOL, "quasiquote"};
94 scm scm_symbol_unquote = {SYMBOL, "unquote"};
97 scm scm_macro = {SYMBOL, "*macro*"};
100 scm scm_symbol_EOF = {SYMBOL, "EOF"};
101 scm scm_symbol_EOF2 = {SYMBOL, "EOF2"};
102 scm scm_symbol_call_with_values = {SYMBOL, "call-with-values"};
103 scm scm_symbol_current_module = {SYMBOL, "current-module"};
104 scm scm_symbol_define = {SYMBOL, "define"};
105 scm scm_symbol_define_macro = {SYMBOL, "define-macro"};
106 scm scm_symbol_eval = {SYMBOL, "eval"};
107 scm scm_symbol_loop2 = {SYMBOL, "loop2"};
108 scm scm_symbol_set_x = {SYMBOL, "set!"};
109 scm scm_symbol_values = {SYMBOL, "values"};
116 return x->type == PAIR ? &scm_f : &scm_t;
122 assert (x->type == PAIR);
129 assert (x->type == PAIR);
134 cons (scm *x, scm *y)
136 scm *p = malloc (sizeof (scm));
144 eq_p (scm *x, scm *y)
147 || (x->type == CHAR && y->type == CHAR
148 && x->value == y->value)
149 || (x->type == NUMBER && y->type == NUMBER
150 && x->value == y->value)
151 // FIXME: alist lookup symbols
152 || (atom_p (x) == &scm_t
159 && atom_p (y) == &scm_t
160 && !strcmp (x->name, y->name)))
167 return eq_p (x, &scm_nil);
173 return x->type == PAIR ? &scm_t : &scm_f;
177 set_cdr_x (scm *x, scm *e)
179 assert (x->type == PAIR);
181 return &scm_unspecified;
185 set_x (scm *x, scm *e, scm *a)
187 return set_cdr_x (assq (x, a), e);
191 set_env_x (scm *x, scm *e, scm *a)
193 return set_cdr_x (assq (x, a), e);
199 return cons (&scm_symbol_quote, x);
206 return cons (&scm_symbol_unquote, x);
212 return cons (&scm_symbol_quasiquote, x);
218 // Derived, non-primitives
219 scm *caar (scm *x) {return car (car (x));}
220 scm *cadr (scm *x) {return car (cdr (x));}
221 scm *cdar (scm *x) {return cdr (car (x));}
222 scm *cddr (scm *x) {return cdr (cdr (x));}
223 scm *caadr (scm *x) {return car (car (cdr (x)));}
224 scm *caddr (scm *x) {return car (cdr (cdr (x)));}
225 scm *cdadr (scm *x) {return cdr (car (cdr (x)));}
226 scm *cadar (scm *x) {return car (cdr (car (x)));}
227 scm *cddar (scm *x) {return cdr (cdr (car (x)));}
228 scm *cdddr (scm *x) {return cdr (cdr (cdr (x)));}
231 pairlis (scm *x, scm *y, scm *a)
234 printf ("pairlis x=");
242 if (atom_p (x) == &scm_t)
243 return cons (cons (x, y), a);
244 return cons (cons (car (x), car (y)),
245 pairlis (cdr (x), cdr (y), a));
249 assq (scm *x, scm *a)
253 printf ("alist miss: %s\n", x->name);
257 if (eq_p (caar (a), x) == &scm_t)
259 return assq (x, cdr (a));
263 eval_quote (scm *fn, scm *x)
265 return apply (fn, x, &scm_nil);
269 apply_ (scm *fn, scm *x, scm *a)
272 printf ("apply fn=");
278 if (atom_p (fn) != &scm_f)
280 if (fn == &scm_symbol_current_module) // FIXME
282 if (eq_p (fn, &scm_symbol_call_with_values) == &scm_t)
283 return call (&scm_call_with_values_env, append2 (x, cons (a, &scm_nil)));
284 if (builtin_p (fn) == &scm_t)
286 return apply (eval (fn, a), x, a);
288 else if (car (fn) == &scm_lambda)
289 return begin_env (cddr (fn), pairlis (cadr (fn), x, a));
290 else if (car (fn) == &scm_label)
291 return apply (caddr (fn), x, cons (cons (cadr (fn), caddr (fn)), a));
292 return &scm_unspecified;
296 begin_env (scm *body, scm *a)
298 if (body == &scm_nil) return &scm_unspecified;
299 scm *result = eval (car (body), a);
300 if (cdr (body) == &scm_nil)
302 return begin_env (cdr (body), a);
306 eval_ (scm *e, scm *a)
315 else if (e->type == NUMBER)
317 else if (e->type == STRING)
319 else if (e->type == VECTOR)
321 else if (atom_p (e) == &scm_t) {
322 scm *y = assq (e, a);
324 printf ("eval: no such symbol: %s\n", e->name);
329 if (builtin_p (e) == &scm_t)
331 else if (atom_p (car (e)) == &scm_t)
336 if (car (e) == &scm_symbol_quote)
338 if (car (e) == &scm_lambda)
340 if (car (e) == &scm_symbol_set_x)
341 return set_env_x (cadr (e), eval (caddr (e), a), a);
343 else if (car (e) == &scm_symbol_unquote)
344 return eval (cadr (e), a);
345 else if (car (e) == &scm_symbol_quasiquote) {
351 display (eval_quasiquote (cadr (e), a));
354 return eval_quasiquote (cadr (e), a);
357 else if (car (e) == &scm_symbol_cond)
358 return evcon (cdr (e), a);
360 else if ((macro = assq (car (e), cdr (assq (&scm_macro, a)))) != &scm_f)
361 return eval (apply_ (cdr (macro), cdr (e), a), a);
363 return apply (car (e), evlis (cdr (e), a), a);
365 return apply (car (e), evlis (cdr (e), a), a);
369 evcon_ (scm *c, scm *a)
372 printf ("evcon_ clause=");
376 if (c == &scm_nil) return &scm_unspecified;
377 if (eval (caar (c), a) != &scm_f) {
379 //if (fn != &scm_display && fn != &scm_call)
380 //if (fn != &scm_call)
381 printf ("#t clause=");
385 printf (" nil=%d", cddar (c) == &scm_nil);
388 if (cddar (c) == &scm_nil)
389 return eval (cadar (c), a);
391 return evcon_ (cons (cons (&scm_t, cddar (c)), &scm_nil), a);
393 return evcon_ (cdr (c), a);
397 evcon (scm *c, scm *a)
400 printf ("\n****evcon=");
404 return evcon_ (c, a);
408 evlis (scm *m, scm *a)
417 scm *e = eval (car (m), a);
418 return cons (e, evlis (cdr (m), a));
426 return (x->type == FUNCTION0
427 || x->type == FUNCTION1
428 || x->type == FUNCTION2
429 || x->type == FUNCTION3
430 || x->type == FUNCTIONn)
437 return x->type == CHAR ? &scm_t : &scm_f;
443 return x->type == NUMBER ? &scm_t : &scm_f;
449 return x->type == STRING ? &scm_t : &scm_f;
455 //TODO: #f,#t,nil also `symbols' atm
456 return x->type == SYMBOL ? &scm_t : &scm_f;
462 return x->type == VECTOR ? &scm_t : &scm_f;
468 return display_helper (x, false, "", false);
472 call (scm *fn, scm *x)
475 //if (fn != &scm_display && fn != &scm_call)
476 //if (fn != &scm_call)
478 printf ("\ncall fn=");
485 if (fn->type == FUNCTION0)
486 return fn->function0 ();
487 if (x->car->type == VALUES)
488 x = cons (x->car->cdr->car, &scm_nil);
489 if (fn->type == FUNCTION1)
490 return fn->function1 (car (x));
491 if (fn->type == FUNCTION2)
492 return fn->function2 (car (x), cadr (x));
493 if (fn->type == FUNCTION3)
494 return fn->function3 (car (x), cadr (x), caddr (x));
495 if (fn->type == FUNCTIONn)
496 return fn->functionn (x);
497 return &scm_unspecified;
501 append2 (scm *x, scm *y)
503 if (x == &scm_nil) return y;
504 assert (x->type == PAIR);
505 return cons (car (x), append2 (cdr (x), y));
509 append (scm *x/*...*/)
511 if (x == &scm_nil) return &scm_nil;
512 return append2 (car (x), append (cdr (x)));
518 scm *p = malloc (sizeof (scm));
527 scm *p = malloc (sizeof (scm));
534 make_string (char const *s)
536 scm *p = malloc (sizeof (scm));
538 p->name = strdup (s);
543 make_symbol (char const *s)
545 // TODO: alist lookup symbols
546 scm *p = malloc (sizeof (scm));
548 p->name = strdup (s);
555 scm *p = malloc (sizeof (scm));
558 p->vector = malloc (n * sizeof (scm*));
563 string (scm *x/*...*/)
567 while (x != &scm_nil)
570 assert (s->type == CHAR);
574 return make_string (buf);
578 string_append (scm *x/*...*/)
582 while (x != &scm_nil)
585 assert (s->type == STRING);
586 strcat (buf, s->name);
589 return make_string (buf);
593 string_length (scm *x)
595 assert (x->type == STRING);
596 return make_number (strlen (x->name));
603 while (x != &scm_nil)
608 return make_number (n);
613 builtin_list (scm *x/*...*/) // int
619 vector (scm *x/*...*/) // int
621 return list_to_vector (x);
626 values (scm *x/*...*/)
628 scm *v = cons (0, x);
634 call_with_values_env (scm *producer, scm *consumer, scm *a)
636 scm *v = apply_ (producer, &scm_nil, a);
637 if (v->type == VALUES)
639 return apply_ (consumer, v, a);
643 vector_length (scm *x)
645 assert (x->type == VECTOR);
646 return make_number (x->length);
650 vector_ref (scm *x, scm *i)
652 assert (x->type == VECTOR);
653 assert (i->value < x->length);
654 return x->vector[i->value];
658 vector_set_x (scm *x, scm *i, scm *e)
660 assert (x->type == VECTOR);
661 assert (i->value < x->length);
662 x->vector[i->value] = e;
663 return &scm_unspecified;
667 lookup (char *x, scm *a)
669 if (isdigit (*x) || (*x == '-' && isdigit (*(x+1))))
670 return make_number (atoi (x));
671 if (*x == '\'') return &scm_symbol_quote;
673 if (!strcmp (x, scm_unspecified.name)) return &scm_unspecified;
674 if (!strcmp (x, scm_symbol_cond.name)) return &scm_symbol_cond;
675 if (!strcmp (x, scm_symbol_quote.name)) return &scm_symbol_quote;
676 if (!strcmp (x, scm_lambda.name)) return &scm_lambda;
677 if (!strcmp (x, scm_label.name)) return &scm_label;
678 if (!strcmp (x, scm_nil.name)) return &scm_nil;
679 if (!strcmp (x, scm_symbol_set_x.name)) return &scm_symbol_set_x;
682 if (*x == '`') return &scm_symbol_quasiquote;
683 if (*x == ',') return &scm_symbol_unquote;
684 if (!strcmp (x, scm_symbol_unquote.name)) return &scm_symbol_unquote;
685 if (!strcmp (x, scm_symbol_quasiquote.name)) return &scm_symbol_quasiquote;
688 return make_symbol (x);
692 lookup_char (int c, scm *a)
697 return lookup (buf, a);
701 list2str (scm *l) // char*
703 static char buf[256];
705 while (l != &scm_nil) {
707 assert (c->type == NUMBER);
716 list_to_vector (scm *x)
718 int n = length (x)->value;
719 scm *v = make_vector (n);
721 while (x != &scm_nil)
730 number_to_string (scm *x)
732 assert (x->type == NUMBER);
734 sprintf (buf,"%d", x->value);
735 return make_string (buf);
739 string_to_symbol (scm *x)
741 assert (x->type == STRING);
742 return make_symbol (x->name);
746 symbol_to_string (scm *x)
748 assert (x->type == SYMBOL);
749 return make_string (x->name);
753 vector_to_list (scm *v)
756 for (int i = 0; i < v->length; i++)
757 x = append2 (x, cons (v->vector[i], &scm_nil));
762 builtin_lookup (scm *l, scm *a)
764 return lookup (list2str (l), a);
768 cossa (scm *x, scm *a)
770 if (a == &scm_nil) return &scm_f;
771 if (eq_p (cdar (a), x) == &scm_t)
773 return cossa (x, cdr (a));
780 return &scm_unspecified;
784 display_helper (scm *x, bool cont, char *sep, bool quote)
788 if (x->type == CHAR && x->value == 10) printf ("#\\%s", "newline");
789 else if (x->type == CHAR && x->value == 32) printf ("#\\%s", "space");
790 else if (x->type == CHAR) printf ("#\\%c", x->value);
791 else if (x->type == NUMBER) printf ("%d", x->value);
792 else if (x->type == PAIR) {
794 if (car (x) == &scm_quote) {
796 return display_helper (car (cdr (x)), cont, "", true);
799 if (car (x) == &scm_quasiquote) {
801 return display_helper (car (cdr (x)), cont, "", true);
803 if (car (x) == &scm_unquote) {
805 return display_helper (car (cdr (x)), cont, "", true);
809 if (!cont) printf ("(");
811 if (cdr (x)->type == PAIR)
812 display_helper (cdr (x), true, " ", false);
813 else if (cdr (x) != &scm_nil) {
817 if (!cont) printf (")");
819 else if (x->type == VECTOR) {
821 for (int i = 0; i < x->length; i++)
822 display_helper (x->vector[i], true, i ? " " : "", false);
825 else if (atom_p (x) == &scm_t) printf ("%s", x->name);
827 return &scm_unspecified;
833 ungetchar (int c) //int
835 return ungetc (c, stdin);
849 return make_number (getchar ());
855 return make_number (peekchar ());
859 builtin_ungetchar (scm *c)
861 assert (c->type == NUMBER);
862 ungetchar (c->value);
869 if (c == '\n') return c;
870 return readcomment (getchar ());
876 if (c == '!' && peekchar () == '#') return getchar ();
877 return readblock (getchar ());
881 readword (int c, char* w, scm *a)
883 if (c == EOF && !w) return &scm_nil;
884 if (c == '\n' && !w) return readword (getchar (), w, a);
885 if (c == '\n' && *w == '.' && w[1] == 0) return &scm_dot;
886 if (c == EOF || c == '\n') return lookup (w, a);
887 if (c == ' ') return readword ('\n', w, a);
888 if (c == '"' && !w) return readstring ();
889 if (c == '"') {ungetchar (c); return lookup (w, a);}
890 if (c == '(' && !w) return readlist (a);
891 if (c == '(') {ungetchar (c); return lookup (w, a);}
892 if (c == ')' && !w) {ungetchar (c); return &scm_nil;}
893 if (c == ')') {ungetchar (c); return lookup (w, a);}
900 && !w) {return cons (lookup_char (c, a),
901 cons (readword (getchar (), w, a),
903 if (c == ';') {readcomment (c); return readword ('\n', w, a);}
904 if (c == '#' && peekchar () == '\\') {getchar (); return readchar ();}
905 if (c == '#' && !w && peekchar () == '(') {getchar (); return list_to_vector (readlist (a));}
906 if (c == '#' && peekchar () == '(') {ungetchar (c); return lookup (w, a);}
907 if (c == '#' && peekchar () == '!') {getchar (); readblock (getchar ()); return readword (getchar (), w, a);}
910 return readword (getchar (), strncat (w ? w : buf, &ch, 1), a);
917 if (c >= '0' && c <= '7'
918 && peekchar () >= '0' && peekchar () <= '7') {
920 while (peekchar () >= '0' && peekchar () <= '7') {
922 c += getchar () - '0';
925 else if (c >= 'a' && c <= 'z'
926 && peekchar () >= 'a' && peekchar () <= 'z') {
930 while (peekchar () >= 'a' && peekchar () <= 'z') {
934 if (!strcmp (buf, "newline")) c = 10;
935 else if (!strcmp (buf, "space")) c = 32;
937 printf ("char not supported: %s", buf);
938 assert (!"char not supported");
941 return make_char (c);
953 if (c == '\\' && peekchar () == '"') *p++ = getchar ();
954 if (c == EOF) assert (!"EOF in string");
958 return make_string (buf);
962 eat_whitespace (int c)
964 while (c == ' ' || c == '\n') c = getchar ();
965 if (c == ';') return eat_whitespace (readcomment (c));
966 if (c == '#' && peekchar () == '!') {getchar (); readblock (getchar ()); return eat_whitespace (getchar ());}
974 c = eat_whitespace (c);
975 if (c == ')') return &scm_nil;
976 scm *w = readword (c, 0, a);
978 return car (readlist (a));
979 return cons (w, readlist (a));
985 return readword (getchar (), 0, a);
988 // Extras to make interesting program
993 puts ("c: hello world");
994 return &scm_unspecified;
998 less_p (scm *a, scm *b)
1000 assert (a->type == NUMBER);
1001 assert (b->type == NUMBER);
1002 return a->value < b->value ? &scm_t : &scm_f;
1006 minus (scm *x/*...*/)
1009 assert (a->type == NUMBER);
1014 while (x != &scm_nil)
1016 assert (x->car->type == NUMBER);
1020 return make_number (n);
1024 plus (scm *x/*...*/)
1027 while (x != &scm_nil)
1029 assert (x->car->type == NUMBER);
1033 return make_number (n);
1037 divide (scm *x/*...*/)
1040 while (x != &scm_nil)
1042 assert (x->car->type == NUMBER);
1046 return make_number (n);
1050 multiply (scm *x/*...*/)
1053 while (x != &scm_nil)
1055 assert (x->car->type == NUMBER);
1059 return make_number (n);
1063 is_p (scm *a, scm *b)
1065 assert (a->type == NUMBER);
1066 assert (b->type == NUMBER);
1067 return a->value == b->value ? &scm_t : &scm_f;
1072 eval_quasiquote (scm *e, scm *a)
1075 printf ("\nc:eval_quasiquote e=");
1077 if (pair_p (e) == &scm_t) {
1078 printf ("\ncar (e)=");
1081 display (atom_p (car (e)));
1085 if (e == &scm_nil) return e;
1086 else if (atom_p (e) == &scm_t) return e;
1087 else if (atom_p (car (e)) == &scm_t)
1088 return cons (car (e), eval_quasiquote (cdr (e), a));
1089 else if (eq_p (caar (e), &scm_symbol_unquote) == &scm_t)
1090 return cons (eval (cadar (e), a), &scm_nil);
1091 else if (eq_p (caar (e), &scm_symbol_quote) == &scm_t)
1092 return cons (cadar (e), &scm_nil);
1093 else if (eq_p (caar (e), &scm_symbol_quasiquote) == &scm_t)
1095 return cons (car (e), eval_quasiquote (cdr (e), a));
1100 add_environment (scm *a, char *name, scm *x)
1102 return cons (cons (make_symbol (name), x), a);
1110 a = add_environment (a, "()", &scm_nil);
1111 a = add_environment (a, "#t", &scm_t);
1112 a = add_environment (a, "#f", &scm_f);
1113 a = add_environment (a, "*unspecified*", &scm_unspecified);
1114 a = add_environment (a, "label", &scm_label);
1115 a = add_environment (a, "lambda", &scm_lambda);
1116 a = add_environment (a, "*macro*", &scm_nil);
1117 a = add_environment (a, "*dot*", &scm_dot);
1118 a = add_environment (a, "current-module", &scm_symbol_current_module);
1120 a = add_environment (a, "'", &scm_quote);
1122 a = add_environment (a, ",", &scm_unquote);
1123 a = add_environment (a, "`", &scm_quasiquote);
1126 #include "environment.i"
1132 define_lambda (scm *x)
1134 return cons (caadr (x), cons (&scm_lambda, cons (cdadr (x), cddr (x))));
1138 define (scm *x, scm *a)
1140 if (atom_p (cadr (x)) != &scm_f)
1141 return cons (cadr (x), eval (caddr (x), a));
1142 return define_lambda (x);
1146 define_macro (scm *x, scm *a)
1149 printf ("\nc:define_macro a=");
1150 scm *aa =cons (&scm_macro,
1151 cons (define_lambda (x),
1152 cdr (assq (&scm_macro, a))));
1156 if (atom_p (cadr (x)) != &scm_f)
1157 return cons (&scm_macro,
1158 cons (cons (cadr (x), eval (caddr (x), a)),
1159 cdr (assq (&scm_macro, a))));
1160 return cons (&scm_macro,
1161 cons (define_lambda (x),
1162 cdr (assq (&scm_macro, a))));
1166 loop (scm *r, scm *e, scm *a)
1169 printf ("\nc:loop e=");
1175 else if (eq_p (e, &scm_symbol_EOF) == &scm_t)
1176 return apply (cdr (assq (&scm_symbol_loop2, a)),
1177 cons (&scm_unspecified, cons (&scm_t, cons (a, &scm_nil))), a);
1178 else if (eq_p (e, &scm_symbol_EOF2) == &scm_t)
1180 else if (atom_p (e) == &scm_t)
1181 return loop (eval (e, a), readenv (a), a);
1182 else if (eq_p (car (e), &scm_symbol_define) == &scm_t)
1183 return loop (&scm_unspecified,
1185 cons (define (e, a), a));
1186 else if (eq_p (car (e), &scm_symbol_define_macro) == &scm_t)
1187 return loop (&scm_unspecified,
1189 cons (define_macro (e, a), a));
1190 else if (eq_p (car (e), &scm_symbol_set_x) == &scm_t)
1191 return loop (set_env_x (cadr (e), eval (caddr (e), a), a), readenv (a), a);
1192 return loop (eval (e, a), readenv (a), a);
1196 main (int argc, char *argv[])
1198 scm *a = mes_environment ();
1199 display (loop (&scm_unspecified, readenv (a), a));
1205 apply (scm *fn, scm *x, scm *a)
1208 printf ("\nc:apply fn=");
1214 if (fn == &scm_apply_)
1215 return eval_ (x, a);
1216 return apply_ (fn, x, a);
1219 bool evalling_p = false;
1222 eval (scm *e, scm *a)
1225 printf ("\nc:eval e=");
1230 scm *eval__ = assq (&scm_symbol_eval, a);
1231 assert (eval__ != &scm_f);
1232 eval__ = cdr (eval__);
1233 if (builtin_p (eval__) == &scm_t
1235 return eval_ (e, a);
1237 scm *r = apply (eval__, cons (e, cons (a, &scm_nil)), a);