shithub: sl

Download patch

ref: 70b910bc7b5f1354c70cd297e4887cc178866a9a
parent: df55d10a88b7ac80aeabe1f01484b37a2e404961
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Mar 13 23:37:54 EDT 2025

is-lambda? → lambda?

--- a/boot/sl.boot
+++ b/boot/sl.boot
@@ -61,8 +61,7 @@
   #:g348 λ prog1 trycatch #:g349 raise))  dotimes #fn("z10<0T20E2187Ke32223e186e1e12415153e4:" #(for
   - #fn(nconc) λ #fn(copy-list)))  throw #fn("n220212223e201e4e2:" #(raise list quote thrown-value)))
 	    1+ #fn("n10KM:" #() 1+) 1-
-	    #fn("n10K~:" #() 1-) 1arg-lambda? #fn("n10B;3E04700<51;3:04710TK62:" #(is-lambda?
-										   length=) 1arg-lambda?)
+	    #fn("n10K~:" #() 1-) 1arg-lambda? #fn("n10B;3E04700<51;3:04710TK62:" #(lambda? length=) 1arg-lambda?)
 	    <= #fn("z1Ib6862086>1_486<^10162:" #(#fn("n21S;JL041<0L2;J5040V340q:A<1<1=62:" #())) <=)
 	    > #fn("z1Ib6862086>1_486<^10162:" #(#fn("n21S;JE041<0L2;3;04A<1<1=62:" #())) >) >=
 	    #fn("z1Ib6862086>1_486<^10162:" #(#fn("n21S;JL0401<L2;J5040V340q:A<1<1=62:" #())) >=)
@@ -130,8 +129,7 @@
 	    compile-and #fn("n570018283D218467:" #(compile-short-circuit brn) compile-and)
 	    compile-app #fn("n483<88R3U07088152JK088Z3E0218851[3;0218851@40887283=23523q07401q895440r40r4GKMp4750183=530r40r4G8:UMp47608237027@40288:63:89[;3904798951892:Cf07089152J\\0212:517:d3P07;83r2523E07401q83T5447602:62:89B3P07<89<513F07=83513=07>01828364:8:360q@F07401q895440r40r4GKMp4750183=530r40r4G8;UMp48:360q@=00r40r4Gr/Mp48:3C07?018283898:8;67:760823702@@402A8;63:" #(in-env?
   #fn(top-level-value) length> 255 compile-in compile-arglist emit tcall.l call.l
-  builtin->instruction cadr length= is-lambda? inlineable? compile-let compile-builtin-call tcall
-  call) compile-app)
+  builtin->instruction cadr length= lambda? inlineable? compile-let compile-builtin-call tcall call) compile-app)
 	    compile-arglist #fn("n3202101>282524228261:" #(#fn(for-each)
 							   #fn("n170AFq0544Ar4Ar4GKMp:" #(compile-in))
 							   #fn(length)) compile-arglist)
@@ -159,7 +157,7 @@
   #fn("n270A21053413K02223AF>2152470A242515163:q:" #(emit loadv #fn(for-each)
 						     #fn("n170AF0q64:" #(compile-sym)) closure #fn(length)))
   and compile-and or compile-or while compile-while cddr return ret set! value-get-doc error "set!: name must be a symbol"
-  symbol-set-doc is-lambda? lambda:vars compile-set! trycatch 1arg-lambda? caddr "trycatch: second form must be a 1-argument lambda") compile-in)
+  symbol-set-doc lambda? lambda:vars compile-set! trycatch 1arg-lambda? caddr "trycatch: second form must be a 1-argument lambda") compile-in)
 	    compile-let #fn("n483<83=0r4G88T70018953718;727388518;528:537408=524258=1<521=P7608>827388515440r40r4G8<UMp4E8<L23A082J<0770288<63:q:" #(compile-arglist
   vars-to-env complex-bindings caddr box-vars #fn(nconc) compile-in emit shift) compile-let)
 	    compile-or #fn("n470018283q21q67:" #(compile-short-circuit brnn) compile-or)
@@ -181,8 +179,8 @@
 									      filter #fn("n120A062:" #(#fn(has?)))
 									      table-keys) complex-bindings)
 	    complex-bindings- #fn("n61J40q:0R3K0833D02001523;021840D63:q:0H;J80472051340q:0<23Co0200T1523Q021850TD534833>021840TD53@30q@30q474750511q83848566:760<513U074770517817905152q82S;J50483848566:740<17:051838485562;2<1838485>40=52P:" #(#fn(memq)
-  #fn(put!) quoted? set! complex-bindings- caddr is-lambda? lambda:body diff lambda:vars
-  inlineable? #fn(map) #fn("n1700AqF929366:" #(complex-bindings-))) complex-bindings-)
+  #fn(put!) quoted? set! complex-bindings- caddr lambda? lambda:body diff lambda:vars inlineable?
+  #fn(map) #fn("n1700AqF929366:" #(complex-bindings-))) complex-bindings-)
 	    const-to-idx-vec #fn("n1200r2G51212285>10KG52485:" #(#fn(vector-alloc)
 								 #fn(for-each)
 								 #fn("n2A10p:" #())) const-to-idx-vec)
@@ -241,7 +239,7 @@
 	    #fn("n10:" #() identity) in-env? #fn("n21B;3F042001<52;J:047101=62:" #(#fn(assq)
 										   in-env?) in-env?)
 	    index-of #fn("n31J40q:01<C5082:7001=82KM63:" #(index-of) index-of) inlineable?
-	    #fn("n10<85B;3u047085<51;3i047185T51;3]04727385T52;3O047485T2552S;3@047685T270=5162:" #(is-lambda?
+	    #fn("n10<85B;3u047085<51;3i047185T51;3]04727385T52;3O047485T2552S;3@047685T270=5162:" #(lambda?
   list? every symbol? length> 255 length= #fn(length)) inlineable?)
 	    io-readall #fn("n1205021850524228561:" #(#fn(buffer)
 						     #fn(io-copy)
@@ -249,12 +247,11 @@
 	    io-readline #fn("n12002162:" #(#fn(io-readuntil) #\newline) io-readline) io-readlines
 	    #fn("n17071062:" #(read-all-of io-readline) io-readlines) iota #fn("n17071062:" #(map-int
   identity) iota)
-	    is-lambda? #fn("n1020Q;J704020Q:" #(λ) is-lambda?) keyword->symbol
-	    #fn("n1200513K021220512386K24865153^161:0:" #(#fn(keyword?)
-							  #fn(symbol)
-							  #fn(str)
-							  #fn(str-sub)
-							  #fn(str-length)) keyword->symbol)
+	    keyword->symbol #fn("n1200513K021220512386K24865153^161:0:" #(#fn(keyword?)
+									  #fn(symbol)
+									  #fn(str)
+									  #fn(str-sub)
+									  #fn(str-length)) keyword->symbol)
 	    keyword-arg? #fn("n10B;3904200<61:" #(#fn(keyword?)) keyword-arg?) lambda-vars
 	    #fn("n1Ib520852185>1_51485<00qq54422237405162:" #(#0#
 							      #fn("n40S;J5040R340D:0B3Z00<R3T082;J504833<0702112263:A<0=1828364:0B3\x8d00<B3\x870730<r2523?074051R360q@=070250<2615442774051513=0A<0=182D64:833<0702112863:A<0=1D8364:0B3>070290<26164:01C:07021162:7029026164:" #(error
@@ -265,9 +262,10 @@
 							      #fn("n10B390700<61:0:" #(keyword->symbol))
 							      to-proper) lambda-vars)
 	    lambda:body #fn("n170061:" #(caddr) lambda:body) lambda:vars
-	    #fn("n1700T61:" #(lambda-vars) lambda:vars) last-pair #fn("n10=H3400:700=61:" #(last-pair) last-pair)
-	    lastcdr #fn("n10H3400:70051=:" #(last-pair) lastcdr) length=
-	    #fn("n21EL2340q:1El23500H:0H3701El2:700=1K~62:" #(length=) length=) length> #fn("n21EL23400:1El23;00B;34040:0H3701EL2:700=1K~62:" #(length>) length>)
+	    #fn("n1700T61:" #(lambda-vars) lambda:vars) lambda? #fn("n1020Q;J704020Q:" #(λ) lambda?)
+	    last-pair #fn("n10=H3400:700=61:" #(last-pair) last-pair) lastcdr
+	    #fn("n10H3400:70051=:" #(last-pair) lastcdr) length= #fn("n21EL2340q:1El23500H:0H3701El2:700=1K~62:" #(length=) length=)
+	    length> #fn("n21EL23400:1El23;00B;34040:0H3701EL2:700=1K~62:" #(length>) length>)
 	    list->vector #fn("n1700}2:" #(vector) list->vector) list-head
 	    #fn("n2701E52340q:0<710=1K~52P:" #(<= list-head) list-head) list-ref #fn("n2700152<:" #(list-tail) list-ref)
 	    list-tail #fn("n2701E523400:710=1K~62:" #(<= list-tail) list-tail) list?
@@ -280,7 +278,7 @@
 	    lower-define #fn("n1I2021?55140H;J804720513400:0<23C<0747505161:760<513K02728e10Te185051e17905164:2:74062:" #(#1#
   #fn("n170051B3N071051B3=02270051P@7073051@607450758551768551863D0278687e328748652P:87:" #(cddr
   cdddr begin caddr void get-defined-vars lower-define λ #fn(map)) λ-body) quoted? def lower-define
-  expand-define is-lambda? #fn(nconc) λ lastcdr #fn(map)) lower-define)
+  expand-define lambda? #fn(nconc) λ lastcdr #fn(map)) lower-define)
 	    macrocall? #fn("n10<R;3904700<61:" #(symbol-syntax) macrocall?) macroexpand
 	    #fn("n1IIIIIIIIIIIb5b6b7b8b9b:b;b<b=b>b?208521_51420862286>1_514208723e1_51420882485868?87>4_5142089258?89>2_514208:268:>1_514208;278:8988>3_514208<288?8:8988>4_514208=29888?>2_514208>2:_514208?2;8?8>8;8<8=>5_5148?<0q62:" #(#0#
   #fn("n20Z;J904200152S:" #(#fn(assq)) top?) #fn("n10H3400:020d3400:0<B3P07105122CF023A<7405151A<0=5162:0<A<0=51P:" #(((begin))
--- a/src/compiler.lsp
+++ b/src/compiler.lsp
@@ -305,13 +305,13 @@
     (emit g 'jmp top)
     (mark-label g end)))
 
-(def (is-lambda? a)
+(def (lambda? a)
   (or (eq? a 'λ)
       (eq? a 'lambda)))
 
 (def (1arg-lambda? func)
   (and (cons? func)
-       (is-lambda? (car func))
+       (lambda? (car func))
        (length= (cadr func) 1)))
 
 (def (compile-short-circuit g env tail? forms default branch outl)
@@ -406,7 +406,7 @@
 (def (inlineable? form)
   (let ((lam (car form)))
     (and (cons? lam)
-         (is-lambda? (car lam))
+         (lambda? (car lam))
          (list? (cadr lam))
          (every symbol? (cadr lam))
          (not (length> (cadr lam) 255))
@@ -455,7 +455,7 @@
                 (begin (compile-in g env nil (cadr x))
                        (emit g 'cadr))
                 (if (and (cons? head)
-                         (is-lambda? (car head))
+                         (lambda? (car head))
                          (inlineable? x))
                     (compile-let g env tail? x)
                     (begin
@@ -515,7 +515,7 @@
                        (when doc
                          (set! value (cdr value))
                          (symbol-set-doc name doc (and (cons? (car value))
-                                                       (is-lambda? (car (car value)))
+                                                       (lambda? (car (car value)))
                                                        (lambda:vars (car value)))))
                      (compile-set! g env name (car value))))
            (trycatch (compile-in g env nil `(λ () ,(cadr x)))
@@ -627,7 +627,7 @@
          e)
         ((eq? (car e) 'def)
          (lower-define (expand-define e)))
-        ((is-lambda? (car e))
+        ((lambda? (car e))
          `(λ ,(cadr e) ,(λ-body e) . ,(lastcdr e)))
         (else
          (map lower-define e))))
@@ -654,7 +654,7 @@
            (put! setd (cadr e) t)
            (if nested (put! capt (cadr e) t)))
          (complex-bindings- (caddr e) vars nil nested capt setd))
-        ((is-lambda? (car e))
+        ((lambda? (car e))
          (complex-bindings- (lambda:body e)
                             (diff vars (lambda:vars e))
                             nil