ref: 55941805f8007c5737acadf962270ef8dbf15b84
parent: a9cb34f653db7332a3b5ab562005cd0149c0ed6d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Dec 23 15:35:30 EST 2024
use (void) where applicable Fixes: https://todo.sr.ht/~ft/femtolisp/26
--- a/aliases.scm
+++ b/aliases.scm
@@ -261,4 +261,4 @@
(define (read-u8) (io-read *input-stream* 'uint8))
(define modulo mod)
-#t
+(void)
--- a/builtins.c
+++ b/builtins.c
@@ -181,7 +181,7 @@
symbol_t *sym = tosymbol(args[0]);
if(!isconstant(sym))
sym->binding = UNBOUND;
- return FL_t;
+ return FL_void;
}
static void
@@ -378,7 +378,7 @@
char *ptr = tostring(args[0]);
if(chdir(ptr))
lerrorf(FL(IOError), "could not cd to %s", ptr);
- return FL_t;
+ return FL_void;
}
BUILTIN("path-exists?", path_existsp)
--- a/compiler.lsp
+++ b/compiler.lsp
@@ -763,13 +763,13 @@
(if (null? lev?)
(begin (disassemble f ip 0)
(newline)
- (return #t)))
+ (return (void))))
(let ((lev (car lev?))
(code (function:code f))
(vals (function:vals f)))
(define (print-val v)
(if (and (function? v) (not (builtin? v)))
- (begin (princ "\n")
+ (begin (newline)
(disassemble v #f (+ lev 1)))
(print v)))
(define (print-inst inst s sz) (princ (if (and ip (= lev 0) (>= ip (1- s)) (< ip (+ s sz)))
@@ -866,4 +866,4 @@
(loop2 (cdr lst))))))
v)))))
-#t
+(void)
--- a/examples/bq.scm
+++ b/examples/bq.scm
@@ -119,4 +119,4 @@
(else
(cons 'nconc (map bq-bracket x)))))
-#t
+(void)
--- a/examples/cps.lsp
+++ b/examples/cps.lsp
@@ -274,7 +274,7 @@
(cons 'a (reset (cons 'b (shift f (cons 1 (f (f (cons 'c ())))))))))
'(a 1 b b c)))
-#t
+(void)
#|
todo:
--- a/flisp.boot
+++ b/flisp.boot
@@ -23,8 +23,8 @@
λ #fn(copy-list) caar let* cadar)) with-input-from #fn("<000z12021e1220e2e1e12315163:" #(#fn(nconc)
with-bindings *input-stream* #fn(copy-list))) unless #fn("<000z1200O211Pe4:" #(if begin)) letrec #fn(">000z1202021e12273052e122240522515154e1222605262:" #(#fn(nconc)
λ #fn(map) car #fn("8000n12021e12205162:" #(#fn(nconc) set! #fn(copy-list)))
- #fn(copy-list) #fn("5000n17060:" #(void)))) time #fn(">000n12050218522e1e2e123024252622e185e327e4e3e3:" #(#fn(gensym)
- let time-now prog1 princ "Elapsed time: " - " seconds\n")) cond #fn(":000z0\x8d\x8a5852085>1_485<061:" #(#fn(">000n10H340O:0<85<20Q;I80485<DQ3C085=J6085<:2185=P:85=J@02285<A<0=51e3:85T23C\x98074758551513c07675855151278685<e2e12886217975855151PA<0=51e4e3:2:50278685<e2e1288675855186e2A<0=51e4e3:2885<2185=PA<0=51e4:" #(else
+ #fn(copy-list) #fn("5000n17060:" #(void)))) time #fn(">000n12050218522e1e2e123024252622e185e32728e5e3e3:" #(#fn(gensym)
+ let time-now prog1 princ "Elapsed time: " - " seconds" *linefeed*)) cond #fn(":000z0\x8d\x8a5852085>1_485<061:" #(#fn(">000n10H340O:0<85<20Q;I80485<DQ3C085=J6085<:2185=P:85=J@02285<A<0=51e3:85T23C\x98074758551513c07675855151278685<e2e12886217975855151PA<0=51e4e3:2:50278685<e2e1288675855186e2A<0=51e4e3:2885<2185=PA<0=51e4:" #(else
begin or => 1arg-lambda? caddr caadr let if cddr #fn(gensym)) cond-clauses->if))) do #fn("J000z220501<2172052217305221240522587268927882829e12:1=51522829e12:82512887e18;52e153e4e3e2e12887e18:52e3:" #(#fn(gensym)
#fn(map) car cadr #fn("6000n170051B38071061:0<:" #(cddr caddr)) letrec λ if #fn(nconc) begin #fn(copy-list))) assert #fn(";000n1200D2122230e2e2e2e4:" #(if
raise quote assert-failed)) case #fn("A000z1\x8d\x8a68620_4215022870e2e12324e125268687>215252e3:" #(#fn("8000n2120C5020:1J40O:1R3=021072151e3:1H3=023072151e3:1=J>0230721<51e3:74751523=0260271e2e3:280271e2e3:" #(else
@@ -175,11 +175,12 @@
#fn(put!))) member
delete-duplicates) delete-duplicates)
diff #fn("8000n20J40q:200<1523:0710=162:0<710=152P:" #(#fn(memq) diff) diff)
- disassemble #fn("U000\x871000.///\x881000I60O?14z282JD07001E53471504D:@30\x8d482<2205123051\x8d\x8d2487>1?:425187>2?;4r4268851\x8a<\x8d8<<8=L3\x93242728888<>2O79537:8<<r4523907150@30\x8d4E87K~2;|48<8<<KM_48>2<8?2=523[08;8>8<<r45348:897>888<<52G5148<8<<r4M_@\x1f12<8?2?523V08;8>8<<K5348:89888<<GG5148<8<<KM_@\xf012<8?2@523e08;8>8<<K5347A2B888<<G8>2CC70r3@30EM515148<8<<KM_@\xb212<8?2D523\\08;8>8<<r45347A2B7>888<<52515148<8<<r4M_@}12<8?2E523\xb808;8>8<<r88>2FC70r4@30EM5347A2B7>888<<52512G5248<8<<r4M_47A2B7>888<<52515148<8<<r4M_48>2FCY07A2G5147A2B7>888<<52512G5248<8<<r4M_@30\x8d@\xec08?2Hc3^08;8>8<<r45347A2B7>888<<52512G5248<8<<r4M_@\xb802<8?2I523e08;8>8<<r25347A2J7K8<<r,7L888<<52g3515248<8<<r2M_@z02<8?2M523e08;8>8<<r45347A2J7K8<<r,7>888<<52g3515248<8<<r4M_@<08;8>8<<E53^1^1@\xc8-:" #(disassemble
- newline #fn(function:code) #fn(function:vals) #fn("9000n10\\3H00[IC07021514720OAKM63:73061:" #(princ
- "\n" disassemble print) print-val) #fn(";000n370A3S0FEl3M071A72151523@0A182ML37023@4024751r5~512602765:" #(princ
- >= 1- " >" " " hex5 ": " " ") print-inst) #fn(length)
- #fn(table-foldl) #fn("7000n382;I?041AF<GQ;34040:" #()) Instructions > #fn("6000n1702161:" #(princ
+ disassemble #fn("U000\x871000.///\x881000I60O?14z282JG07001E534715047260:@30\x8d482<2305124051\x8d\x8d2587>1?:426187>2?;4r4278851\x8a<\x8d8<<8=L3\x93242829888<>2O7:537;8<<r4523907150@30\x8d4E87K~2<|48<8<<KM_48>2=8?2>523[08;8>8<<r45348:897?888<<52G5148<8<<r4M_@\x1f12=8?2@523V08;8>8<<K5348:89888<<GG5148<8<<KM_@\xf012=8?2A523e08;8>8<<K5347B2C888<<G8>2DC70r3@30EM515148<8<<KM_@\xb212=8?2E523\\08;8>8<<r45347B2C7?888<<52515148<8<<r4M_@}12=8?2F523\xb808;8>8<<r88>2GC70r4@30EM5347B2C7?888<<52512H5248<8<<r4M_47B2C7?888<<52515148<8<<r4M_48>2GCY07B2H5147B2C7?888<<52512H5248<8<<r4M_@30\x8d@\xec08?2Ic3^08;8>8<<r45347B2C7?888<<52512H5248<8<<r4M_@\xb802=8?2J523e08;8>8<<r25347B2K7L8<<r,7M888<<52g3515248<8<<r2M_@z02=8?2N523e08;8>8<<r45347B2K7L8<<r,7?888<<52g3515248<8<<r4M_@<08;8>8<<E53^1^1@\xc8-:" #(disassemble
+ newline void #fn(function:code) #fn(function:vals)
+ #fn("9000n10\\3F00[IA070504710OAKM63:72061:" #(newline disassemble print) print-val)
+ #fn(";000n370A3S0FEl3M071A72151523@0A182ML37023@4024751r5~512602765:" #(princ >= 1- " >" " "
+ hex5 ": " " ") print-inst)
+ #fn(length) #fn(table-foldl) #fn("7000n382;I?041AF<GQ;34040:" #()) Instructions > #fn("6000n1702161:" #(princ
"\t")) #fn(memq) (loadv.l loadg.l setg.l) ref-int32-LE (loadv loadg setg)
(loada seta loadc call tcall list + - * / vector argc vargc loadi8 apply tapply closure box shift
aref) princ #fn(number->string) aref (loada.l seta.l loadc.l largc lvargc call.l tcall.l box.l)
@@ -305,8 +306,8 @@
mod0 #fn("7000n2001k1i2~:" #() mod0) nan?
#fn("6000n1020d;I704021d:" #(+nan.0 -nan.0) nan?) negative? #fn("6000n10EL:" #() negative?)
nestlist #fn(":000n37082E52340q:1710015182K~53P:" #(<= nestlist) nestlist) newline
- #fn("8000\x8700001000\x880000I7070?0421072524D:" #(*output-stream* #fn(io-write)
- *linefeed*) newline)
+ #fn("8000\x8700001000\x880000I7070?04210725247360:" #(*output-stream* #fn(io-write)
+ *linefeed* void) newline)
nreconc #fn("7000n2701062:" #(reverse!-) nreconc) odd?
#fn("6000n170051S:" #(even?) odd?) partition #fn(":000n2\x8d20?648601qe1qe164:" #(#fn("9000n48283P\x8d1B3Z0401<513?0821<qPN=?2@<0831<qPN=?341=?1@\x05/47088<=88==62:" #(values) partition-)) partition)
positive? #fn("7000n1700E62:" #(>) positive?) princ
--- a/flisp.c
+++ b/flisp.c
@@ -1961,7 +1961,7 @@
USED(args);
argcount(nargs, 0);
gc(0);
- return FL_t;
+ return FL_void;
}
BUILTIN("function", function)
@@ -2197,7 +2197,7 @@
h->i = 0;
}
POPN(pargs+1);
- return FL_t;
+ return FL_void;
}
_applyn(pargs);
POPN(pargs+1);
@@ -2210,7 +2210,7 @@
argcount(nargs, 1);
double s = nargs > 0 ? todouble(args[0]) : 0;
sleep_ms(s * 1000.0);
- return FL_t;
+ return FL_void;
}
BUILTIN("*vm-stats*", vm_stats)
@@ -2224,7 +2224,7 @@
ios_printf(ios_stderr, "gc calls %10"PRIu64"\n", (uint64_t)FL(gccalls));
ios_printf(ios_stderr, "max finalizers %10"PRIu32"\n", (uint32_t)FL(maxfinalizers));
ios_printf(ios_stderr, "opcodes %10d\n", N_OPCODES);
- return FL_t;
+ return FL_void;
}
static const builtinspec_t builtin_fns[] = {
--- a/iostream.c
+++ b/iostream.c
@@ -176,7 +176,7 @@
{
argcount(nargs, 1);
ios_close(toiostream(args[0]));
- return FL_t;
+ return FL_void;
}
BUILTIN("io-discardbuffer", io_discardbuffer)
@@ -183,7 +183,7 @@
{
argcount(nargs, 1);
ios_purge(toiostream(args[0]));
- return FL_t;
+ return FL_void;
}
BUILTIN("io-eof?", io_eofp)
@@ -357,7 +357,7 @@
{
argcount(nargs, 2);
toiostream(args[0])->loc.lineno = tosize(args[1]);
- return FL_t;
+ return args[1];
}
BUILTIN("io-column", io_column)
@@ -370,7 +370,7 @@
{
argcount(nargs, 2);
toiostream(args[0])->loc.colno = tosize(args[1]);
- return FL_t;
+ return args[1];
}
value_t
--- a/mkboot0.lsp
+++ b/mkboot0.lsp
@@ -1,8 +1,5 @@
; -*- scheme -*-
-(if (not (bound? 'top-level-value)) (set! top-level-value %eval))
-(if (not (bound? 'set-top-level-value!)) (set! set-top-level-value! set))
-
(define update-compiler
(let ((C ()))
(with-bindings
@@ -20,7 +17,7 @@
(if (not (io-eof? in))
(begin
(print (compile-thunk (expand E)))
- (princ "\n")
+ (newline)
(next (read in)))))
(io-close in)))
--- a/sixel.c
+++ b/sixel.c
@@ -86,7 +86,7 @@
lerrorf(FL(ArgError), "invalid scale factor: %dx%d", scalex, scaley);
f->scalex = scalex;
f->scaley = scaley;
- return FL_t;
+ return FL_void;
}
// :: sixel-output -> palette -> [paltype ->] ...
@@ -160,7 +160,7 @@
}
sixel_dither_set_palette(f->dither, out);
- return FL_t;
+ return FL_void;
}
// :: sixel-output -> iostream -> pixels -> width -> height -> ...
@@ -211,7 +211,7 @@
r = sixel_encode(pix, w, h, 0, f->dither, f->out);
if(SIXEL_FAILED(r))
lerrorf(FL(IOError), "could not encode image");
- return FL_t;
+ return FL_void;
}
static void
--- a/system.lsp
+++ b/system.lsp
@@ -570,7 +570,7 @@
`(let ((,t0 (time-now)))
(prog1
,expr
- (princ "Elapsed time: " (- (time-now) ,t0) " seconds\n")))))
+ (princ "Elapsed time: " (- (time-now) ,t0) " seconds" *linefeed*)))))
; text I/O --------------------------------------------------------------------
@@ -581,7 +581,7 @@
(define (newline (port *output-stream*))
(io-write port *linefeed*)
- #t)
+ (void))
(define (io-readline s) (io-readuntil s #\linefeed))
@@ -919,9 +919,8 @@
; evaluate last form in almost-tail position
(load-process E))))
(λ (e)
- (begin
- (io-close F)
- (raise `(load-error ,filename ,e)))))))
+ (io-close F)
+ (raise `(load-error ,filename ,e))))))
(define (repl)
(define (prompt)
--- a/test/number-boundaries.lsp
+++ b/test/number-boundaries.lsp
@@ -92,5 +92,5 @@
(assert (= -36893488147419103230 (* (high-border uint64) -2)))
(assert (= -36893488147419103230 (* -2 (high-border uint64))))
-(princ "all number boundaries tests pass\n\n")
-#t
+(princ "all number boundaries tests pass")
+(newline)
--- a/test/tme.lsp
+++ b/test/tme.lsp
@@ -1,4 +1,3 @@
(let ((t (table)))
(time (dotimes (i 2000000)
(put! t (rand) (rand)))))
-#t
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -445,5 +445,5 @@
;; now allocate enough to trigger GC
(for 1 8000000 (λ (i) (cons 1 2)))
-(princ "all tests pass\n")
-#t
+(princ "all tests pass")
+(newline)