@@ -732,8 +732,8 @@ bool listp (object *x) {
732
732
733
733
#define improperp (x ) (!listp(x))
734
734
735
- object *quote ( object *arg ) {
736
- return cons (bsymbol (QUOTE ), cons (arg, NULL ));
735
+ object *quoteit ( builtin_t quoter, object *it ) {
736
+ return cons (bsymbol (quoter ), cons (it, nil ));
737
737
}
738
738
739
739
// Radix 40 encoding
@@ -2403,7 +2403,7 @@ object *tf_cond (object *args, object *env) {
2403
2403
object *test = eval (first (clause), env);
2404
2404
object *forms = cdr (clause);
2405
2405
if (test != nil) {
2406
- if (forms == NULL ) return quote ( test); else return tf_progn (forms, env);
2406
+ if (forms == NULL ) return quoteit (QUOTE, test); else return tf_progn (forms, env);
2407
2407
}
2408
2408
args = cdr (args);
2409
2409
}
@@ -3904,7 +3904,7 @@ object *fn_pprintall (object *args, object *env) {
3904
3904
if (consp (val) && symbolp (car (val)) && builtin (car (val)->name ) == LAMBDA) {
3905
3905
superprint (cons (bsymbol (DEFUN), cons (var, cdr (val))), 0 , pfun);
3906
3906
} else {
3907
- superprint (cons (bsymbol (DEFVAR), cons (var, cons (quote ( val), NULL ))), 0 , pfun);
3907
+ superprint (cons (bsymbol (DEFVAR), cons (var, cons (quoteit (QUOTE, val), NULL ))), 0 , pfun);
3908
3908
}
3909
3909
pln (pfun);
3910
3910
testescape ();
@@ -5570,7 +5570,7 @@ object *nextitem (gfun_t gfun) {
5570
5570
}
5571
5571
if (buffer[0 ] == ' :' ) { // handle keywords
5572
5572
if (lookupbuiltin (buffer) == ENDFUNCTIONS) // make sure it isn't a special keyword
5573
- sym = cons ( bsymbol ( QUOTE), cons ( sym, nil) ); // keywords quote themselves
5573
+ sym = quoteit ( QUOTE, sym); // keywords quote themselves
5574
5574
}
5575
5575
return sym;
5576
5576
}
@@ -5584,13 +5584,13 @@ object *readrest (gfun_t gfun) {
5584
5584
if (item == (object *)BRA) {
5585
5585
item = readrest (gfun);
5586
5586
} else if (item == (object *)QUO) {
5587
- item = cons ( bsymbol ( QUOTE), cons ( read (gfun), NULL ));
5587
+ item = quoteit ( QUOTE, read (gfun));
5588
5588
} else if (item == (object *)BACKTICK) {
5589
- item = cons ( bsymbol ( QUASIQUOTE), cons ( read (gfun), NULL ));
5589
+ item = quoteit ( QUASIQUOTE, read (gfun));
5590
5590
} else if (item == (object *)COMMA) {
5591
- item = cons ( bsymbol ( UNQUOTE), cons ( read (gfun), NULL ));
5591
+ item = quoteit ( UNQUOTE, read (gfun));
5592
5592
} else if (item == (object *)COMMAAT) {
5593
- item = cons ( bsymbol ( UNQUOTESPLICING), cons ( read (gfun), NULL ));
5593
+ item = quoteit ( UNQUOTESPLICING, read (gfun));
5594
5594
} else if (item == (object *)DOT) {
5595
5595
tail->cdr = read (gfun);
5596
5596
if (readrest (gfun) != NULL ) error2 (NIL, PSTR (" malformed list" ));
@@ -5611,10 +5611,10 @@ object *read (gfun_t gfun) {
5611
5611
if (item == (object *)KET) error2 (NIL, PSTR (" incomplete list" ));
5612
5612
if (item == (object *)BRA) return readrest (gfun);
5613
5613
if (item == (object *)DOT) return read (gfun);
5614
- if (item == (object *)QUO) return cons ( bsymbol ( QUOTE), cons ( read (gfun), NULL ));
5615
- if (item == (object *)BACKTICK) return cons ( bsymbol ( QUASIQUOTE), cons ( read (gfun), NULL ));
5616
- if (item == (object *)COMMA) return cons ( bsymbol ( UNQUOTE), cons ( read (gfun), NULL ));
5617
- if (item == (object *)COMMAAT) return cons ( bsymbol ( UNQUOTESPLICING), cons ( read (gfun), NULL ));
5614
+ if (item == (object *)QUO) return quoteit ( QUOTE, read (gfun));
5615
+ if (item == (object *)BACKTICK) return quoteit ( QUASIQUOTE, read (gfun));
5616
+ if (item == (object *)COMMA) return quoteit ( UNQUOTE, read (gfun));
5617
+ if (item == (object *)COMMAAT) return quoteit ( UNQUOTESPLICING, read (gfun));
5618
5618
return item;
5619
5619
}
5620
5620
0 commit comments