Skip to content

Commit da3b2e1

Browse files
use quoteit function as generic quote
1 parent e8452c6 commit da3b2e1

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

ulisp-esp32.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ bool listp (object *x) {
732732

733733
#define improperp(x) (!listp(x))
734734

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));
737737
}
738738

739739
// Radix 40 encoding
@@ -2403,7 +2403,7 @@ object *tf_cond (object *args, object *env) {
24032403
object *test = eval(first(clause), env);
24042404
object *forms = cdr(clause);
24052405
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);
24072407
}
24082408
args = cdr(args);
24092409
}
@@ -3904,7 +3904,7 @@ object *fn_pprintall (object *args, object *env) {
39043904
if (consp(val) && symbolp(car(val)) && builtin(car(val)->name) == LAMBDA) {
39053905
superprint(cons(bsymbol(DEFUN), cons(var, cdr(val))), 0, pfun);
39063906
} 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);
39083908
}
39093909
pln(pfun);
39103910
testescape();
@@ -5570,7 +5570,7 @@ object *nextitem (gfun_t gfun) {
55705570
}
55715571
if (buffer[0] == ':') { // handle keywords
55725572
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
55745574
}
55755575
return sym;
55765576
}
@@ -5584,13 +5584,13 @@ object *readrest (gfun_t gfun) {
55845584
if (item == (object *)BRA) {
55855585
item = readrest(gfun);
55865586
} else if (item == (object *)QUO) {
5587-
item = cons(bsymbol(QUOTE), cons(read(gfun), NULL));
5587+
item = quoteit(QUOTE, read(gfun));
55885588
} else if (item == (object *)BACKTICK) {
5589-
item = cons(bsymbol(QUASIQUOTE), cons(read(gfun), NULL));
5589+
item = quoteit(QUASIQUOTE, read(gfun));
55905590
} else if (item == (object *)COMMA) {
5591-
item = cons(bsymbol(UNQUOTE), cons(read(gfun), NULL));
5591+
item = quoteit(UNQUOTE, read(gfun));
55925592
} else if (item == (object *)COMMAAT) {
5593-
item = cons(bsymbol(UNQUOTESPLICING), cons(read(gfun), NULL));
5593+
item = quoteit(UNQUOTESPLICING, read(gfun));
55945594
} else if (item == (object *)DOT) {
55955595
tail->cdr = read(gfun);
55965596
if (readrest(gfun) != NULL) error2(NIL, PSTR("malformed list"));
@@ -5611,10 +5611,10 @@ object *read (gfun_t gfun) {
56115611
if (item == (object *)KET) error2(NIL, PSTR("incomplete list"));
56125612
if (item == (object *)BRA) return readrest(gfun);
56135613
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));
56185618
return item;
56195619
}
56205620

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy