shithub: femtolisp

Download patch

ref: c48cb65963f0fab8576020a00a04578f1d23e2b9
parent: dd5b367d7490124cb66d7815c33cdab675451f61
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Dec 20 02:00:35 EST 2024

fix nil reading, make it case insensitive

--- a/flisp.boot
+++ b/flisp.boot
@@ -308,9 +308,8 @@
 	    nestlist #fn(":000n37082E52340q:1710015182K~53P:" #(<= nestlist) nestlist) newline
 	    #fn("8000\x8700001000\x880000I7070?0421072524D:" #(*output-stream* #fn(io-write)
 							       *linefeed*) newline)
-	    nil nil nreconc
-	    #fn("7000n2701062:" #(reverse!-) nreconc) odd? #fn("6000n170051S:" #(even?) odd?)
-	    partition #fn(":000n2D20?648601qe1qe164:" #(#fn("9000n48283PD1B3Z0401<513?0821<qPN=?2@<0831<qPN=?341=?1@\x05/47088<=88==62:" #(values) partition-)) partition)
+	    nreconc #fn("7000n2701062:" #(reverse!-) nreconc) odd?
+	    #fn("6000n170051S:" #(even?) odd?) partition #fn(":000n2D20?648601qe1qe164:" #(#fn("9000n48283PD1B3Z0401<513?0821<qPN=?2@<0831<qPN=?341=?1@\x05/47088<=88==62:" #(values) partition-)) partition)
 	    positive? #fn("7000n1700E62:" #(>) positive?) princ
 	    #fn(";000z070Ow042185>1220>12386>1{86504:" #(*print-readably* #fn("5000n0Aw0:" #(*print-readably*))
 							 #fn("7000n02071A62:" #(#fn(for-each) write))
--- a/flisp.c
+++ b/flisp.c
@@ -2298,7 +2298,6 @@
 	FL(Tsym) = symbol("T", false);
 	FL(fsym) = symbol("f", false);
 	FL(Fsym) = symbol("F", false);
-	set(symbol("nil", false), FL_nil);
 	FL(builtins_table_sym) = symbol("*builtins*", false);
 	set(FL(printprettysym) = symbol("*print-pretty*", false), FL_t);
 	set(FL(printreadablysym) = symbol("*print-readably*", false), FL_t);
--- a/read.c
+++ b/read.c
@@ -362,7 +362,7 @@
 		}
 		ctx->toktype = TOK_SYM;
 		char *name = (strcmp(ctx->buf, "lambda") == 0 || strcmp(ctx->buf, "λ") == 0) ? "λ" : ctx->buf;
-		ctx->tokval = symbol(name, name == ctx->buf);
+		ctx->tokval = strcasecmp(name, "nil") == 0 ? FL_nil : symbol(name, name == ctx->buf);
 	}
 	return ctx->toktype;
 }