ref: 33cfd0c3a7b0ace96e79dacacb9c69230a633312
parent: bda10587a8c0e776dbc7f2717bce95c16e259b8b
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Dec 8 12:44:44 EST 2024
remove table-foreach
--- a/compiler.lsp
+++ b/compiler.lsp
@@ -145,7 +145,7 @@
(set! i (+ i 1)))))
(else #f))))))
- (table-foreach
+ (for-each
(λ (addr labl)
(begin (io-seek bcode addr)
(io-write bcode ((if long? int32 int16)
@@ -156,8 +156,8 @@
(define (const-to-idx-vec e)
(let ((cvec (vector-alloc (bcode:nconst e))))
- (table-foreach (λ (val idx) (aset! cvec idx val))
- (bcode:ctable e))
+ (for-each (λ (val idx) (aset! cvec idx val))
+ (bcode:ctable e))
cvec))
;; variables
--- a/flisp.boot
+++ b/flisp.boot
@@ -178,8 +178,8 @@
complex-bindings- #fn("=000n61J40O:0R3K0833D02001523;021840D63:D:0H;I80472051340O:0<23Co0200T1523Q021850TD534833>021840TD53@30D@30D474750511O83848566:760<513U074770517817905152O82S;I50483848566: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(";000n1700AOF929366:" #(complex-bindings-))) complex-bindings-)
- const-to-idx-vec #fn("9000n1207105151722385>17405152485:" #(#fn(vector-alloc)
- bcode:nconst table-foreach #fn("7000n2A10p:" #()) bcode:ctable) const-to-idx-vec)
+ const-to-idx-vec #fn("9000n1207105151222385>17405152485:" #(#fn(vector-alloc)
+ bcode:nconst #fn(for-each) #fn("7000n2A10p:" #()) bcode:ctable) const-to-idx-vec)
copy-tree #fn("7000n10H3400:700<51700=51P:" #(copy-tree) copy-tree)
count #fn("9000n2D\x8a6862086>1_486<01E63:" #(#fn("9000n31J5082:A<01=01<5139082KM@408263:" #() count-)) count)
delete-duplicates #fn(":000n1700rD523O02150D\x8a686228586>2_486<^10q62:0H3400:0<0=73858652390748661:85748651P:" #(length>
@@ -209,7 +209,7 @@
emit-optional-arg-inits #fn("<000n582B3\x900700517102284534710238953474075176838452q53O7782515447102884534710295247:0895247;0182=8384KM65:D:" #(make-label
emit brbound brt compile-in extend-env list-head cadar seta pop mark-label
emit-optional-arg-inits) emit-optional-arg-inits)
- encode-byte-code #fn("S000n17005171855172238651r3238651r2ki2M2452238651E255025502650OO278<28524D8988L3\xd9148689G?=48=29CP02:8:8689KMG2;8<5153489r2M?9@\xa81278<2<2=7>873\x8308=8D2?C702@@p08D2AC702B@d08D2CC702D@X08D2EC702F@L08D2GC702H@@08D2IC702J@408=^1@408=525152489KM?948988L3:08689G@30O?>42K8=2L523`02:8;2;8<518>534278<873707M@407NE5152489KM?9@\xeb08=2OCH0278<2P8>5152489KM?9@\xce08>X3\xc708=2K8?2Q523H0278<2P8>5152489KM?9@\x9f02K8?2R523\x810278<2P8>5152489KM?94278<2P8689G5152489KM?948=2SCK0278<2P8689G5152489KM?9@30D@E0278<2T8>5152489KM?9^1@30O@\x83.47U2V8<878:>38;5242W8<61:" #(reverse!
+ encode-byte-code #fn("S000n17005171855172238651r3238651r2ki2M2452238651E255025502650OO278<28524D8988L3\xd9148689G?=48=29CP02:8:8689KMG2;8<5153489r2M?9@\xa81278<2<2=7>873\x8308=8D2?C702@@p08D2AC702B@d08D2CC702D@X08D2EC702F@L08D2GC702H@@08D2IC702J@408=^1@408=525152489KM?948988L3:08689G@30O?>42K8=2L523`02:8;2;8<518>534278<873707M@407NE5152489KM?9@\xeb08=2OCH0278<2P8>5152489KM?9@\xce08>X3\xc708=2K8?2Q523H0278<2P8>5152489KM?9@\x9f02K8?2R523\x810278<2P8>5152489KM?94278<2P8689G5152489KM?948=2SCK0278<2P8689G5152489KM?9@30D@E0278<2T8>5152489KM?9^1@30O@\x83.42U2V8<878:>38;5242W8<61:" #(reverse!
list->vector >= #fn(length) 65536 #fn(table)
#fn(buffer) #fn(io-write) #int32(0) label #fn(put!)
#fn(sizeof) #fn(byte) #fn(get) Instructions jmp jmp.l brt brt.l brf brf.l
@@ -216,8 +216,12 @@
brne brne.l brnn brnn.l brn brn.l #fn(memq)
(jmp brf brt brne brnn brn) int32 int16 brbound #fn(int32)
(loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l loadc.l
- box.l) (optargs keyargs) keyargs #fn(uint8) table-foreach #fn(";000n220A052421AF37072@407324921520~5162:" #(#fn(io-seek)
- #fn(io-write) int32 int16 #fn(get))) #fn(iostream->string)) encode-byte-code)
+ box.l) (optargs keyargs) keyargs #fn(uint8)
+ #fn(for-each) #fn(";000n220A052421AF37072@407324921520~5162:" #(#fn(io-seek)
+ #fn(io-write)
+ int32 int16
+ #fn(get)))
+ #fn(iostream->string)) encode-byte-code)
eq #.eq? error
#fn("9000z020210P61:" #(#fn(raise) error) error) eval #fn("7000n170710515160:" #(compile-thunk
expand) eval)
@@ -412,8 +416,6 @@
table-clone #fn("9000n12050212285>1q053485:" #(#fn(table)
#fn(table-foldl)
#fn("8000n320A0163:" #(#fn(put!)))) table-clone)
- table-foreach #fn("8000n220210>1q163:" #(#fn(table-foldl)
- #fn("7000n3A01524D:" #())) table-foreach)
table-invert #fn("9000n12050212285>1q053485:" #(#fn(table)
#fn(table-foldl)
#fn("8000n320A1063:" #(#fn(put!)))) table-invert)
--- a/gen.lsp
+++ b/gen.lsp
@@ -127,7 +127,7 @@
opcodes 4)
(io-write c-header "\tN_OPCODES\n};\n\n")
(io-write c-header "static const Builtin builtins[] = {\n")
- (table-foreach
+ (for-each
(λ (c la) (begin (io-write c-header "\t[")
(write c c-header)
(io-write c-header "] = {\"")
--- a/system.lsp
+++ b/system.lsp
@@ -640,8 +640,6 @@
(table-foldl (λ (k v z) (put! nt v k))
() t)
nt))
-(define (table-foreach f t)
- (table-foldl (λ (k v z) (begin (f k v) #t)) () t))
; string functions ------------------------------------------------------------