shithub: femtolisp

Download patch

ref: aba7c4163ebf0709d0181ee6901d51d87b44bff5
parent: cbeb8907f1cf1526df24c62cc9166ca51aac32bc
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Jan 5 14:17:53 EST 2025

define-macro: return void

--- a/flisp.boot
+++ b/flisp.boot
@@ -42,8 +42,8 @@
   λ #fn(map) #fn("5000n10B3500<:0:" #()) #fn(copy-list)
   #fn("5000n10B3500T:7060:" #(void)) letrec))  with-bindings #fn("G000z12071052207205220230522425e12076888653e12720288687535129242:e12715152242:e127202;8688535152e3e164:" #(#fn(map)
   car cadr #fn("5000n12060:" #(#fn(gensym))) #fn(nconc) let list #fn(copy-list)
-  #fn("7000n22001e3:" #(set!)) unwind-protect begin #fn("7000n22001e3:" #(set!))))  define-macro #fn("@000z170151863D0710<860=5341=?1@30O422230<e22425e10=e12615153e3:" #(value-get-doc
-  symbol-set-doc set-syntax! quote #fn(nconc) λ #fn(copy-list)))  receive #fn("?000z22021q1e32221e10e123825153e3:" #(call-with-values
+  #fn("7000n22001e3:" #(set!)) unwind-protect begin #fn("7000n22001e3:" #(set!))))  define-macro #fn("A000z170151863D0710<860=5341=?1@30O42223240<e22526e10=e12715153e3e2:" #(value-get-doc
+  symbol-set-doc void set-syntax! quote #fn(nconc) λ #fn(copy-list)))  receive #fn("?000z22021q1e32221e10e123825153e3:" #(call-with-values
   λ #fn(nconc) #fn(copy-list)))  dotimes #fn("A000z10<0T20E2187Ke32223e186e1e12415153e4:" #(for -
   #fn(nconc) λ #fn(copy-list)))  > #fn("<000z12021e12273151510e163:" #(#fn(nconc) < #fn(copy-list)
 								       reverse!))  quasiquote #fn("7000n1700E62:" #(bq-process))  when #fn(";000z1200211POe4:" #(if
@@ -285,7 +285,7 @@
 	    #fn("9000n2701E52340q:0<710=1K~52P:" #(<= list-head) list-head) list-ref #fn("7000n2700152<:" #(list-tail) list-ref)
 	    list-tail #fn("8000n2701E523400:710=1K~62:" #(<= list-tail) list-tail) list?
 	    #fn("6000n10V;I@040B;3904700=61:" #(list?) list?) load #fn("9000n120071522285>123850>2{:" #(#fn(file)
-  :read #fn("9000n0\x8d\x8a48420A84>2_484<^1\x8d\x8d\x8d63:" #(#fn("9000n320A51IG0F<21A510721514735063:24A5147215147360:" #(#fn(io-eof?)
+  :read #fn("9000n0\x8d\x8a48420A84>2_484<^1\x8d\x8d\x8d63:" #(#fn("9000n320A51IG0F<21A510721514735063:24A514737215161:" #(#fn(io-eof?)
   #fn(read) load-process void #fn(io-close))))) #fn("8000n120A5142122F0e361:" #(#fn(io-close)
 										#fn(raise)
 										load-error))) load)
@@ -374,10 +374,10 @@
 	    remprop #fn("8000n220711O5386;3F042286052;3:042386062:" #(#fn(get) *properties* #fn(has?)
 								      #fn(del!)) remprop)
 	    repl #fn(";000n0\x8d\x8d\x8a4\x8a5208421_5142085228485>2_51485<5047360:" #(#0#
-										       #fn("9000n07050421725142324{257651S;3[04778451788551360O@=079855147:50485w;47<60:" #(*prompt*
+										       #fn("9000n07050421725142324{257651S;3Z04778451788551360O@=079855147:5047;85w<61:" #(*prompt*
   #fn(io-flush) *output-stream* #fn("5000n02060:" #(#fn(read)))
   #fn("6000n1207151422061:" #(#fn(io-discardbuffer) *input-stream* #fn(raise)))
-  #fn(io-eof?) *input-stream* load-process void? print newline that void) prompt)
+  #fn(io-eof?) *input-stream* load-process void? print newline void that) prompt)
 										       #fn("6000n020A>121{370F<60:O:" #(#fn("5000n0A<60:" #())
   #fn("6000n1700514D:" #(top-level-exception-handler))) reploop) newline) repl)
 	    revappend #fn("7000n2701062:" #(reverse-) revappend) reverse
binary files a/flisp.boot.builtin b/flisp.boot.builtin differ
--- a/system.lsp
+++ b/system.lsp
@@ -3,6 +3,20 @@
 ; by Jeff Bezanson (C) 2009
 ; Distributed under the BSD License
 
+;;; void
+
+(define (void . rest)
+  "Return the constant #<void> while ignoring any arguments.
+#<void> is mainly used when a function has side effects but does not
+produce any meaningful value to return, so even though #t or nil could
+be returned instead, in case of #<void> alone, REPL will not print
+it."
+  #.(void))
+
+(define (void? x)
+  "Return #t if x is #<void> and #f otherwise."
+  (eq? x #.(void)))
+
 ;;; syntax environment
 
 (unless (bound? '*syntax-environment*)
@@ -16,8 +30,8 @@
     (when doc
       (symbol-set-doc (car form) doc (cdr form))
       (set! body (cdr body)))
-    `(set-syntax! ',(car form)
-                  (λ ,(cdr form) ,@body))))
+    `(void (set-syntax! ',(car form)
+                  (λ ,(cdr form) ,@body)))))
 
 (define-macro (letrec binds . body)
   `((λ ,(map car binds)
@@ -139,20 +153,6 @@
         (rest  (cdr body)))
     (and (string? first) (cons? rest) first)))
 
-;;; void
-
-(define (void . rest)
-  "Return the constant #<void> while ignoring any arguments.
-#<void> is mainly used when a function has side effects but does not
-produce any meaningful value to return, so even though #t or nil could
-be returned instead, in case of #<void> alone, REPL will not print
-it."
-  #.(void))
-
-(define (void? x)
-  "Return #t if x is #<void> and #f otherwise."
-  (eq? x #.(void)))
-
 ;;; standard procedures
 
 (define (member item lst)
@@ -958,8 +958,7 @@
                  (begin (load-process E) (void)))
            (begin (io-close F)
                   ; evaluate last form in almost-tail position
-                  (load-process E)
-                  (void))))
+                  (void (load-process E)))))
      (λ (e)
        (io-close F)
        (raise `(load-error ,filename ,e))))))
@@ -974,8 +973,7 @@
       (and (not (io-eof? *input-stream*))
            (let ((V (load-process v)))
              (unless (void? V) (print V) (newline))
-             (set! that V)
-             (void)))))
+             (void (set! that V))))))
   (define (reploop)
     (when (trycatch (prompt)
                     (λ (e)