ref: 5c496f0afe4c6851903ac17690ec61e84cb6ef89
parent: ab269ebae7e261ea53a0c482cd1dd6fe66754794
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Mar 14 03:29:25 EDT 2025
symbol → sym
--- a/boot/sl.boot
+++ b/boot/sl.boot
@@ -20,11 +20,10 @@
n)) __finish ((status)) doc-for ((term (doc NIL))) rand-u32 (NIL) = ((a . rest)) rand-u64 (NIL) car ((lst)) <= ((a . rest)) add-exit-hook ((fun)) /= ((a . rest)) lz-pack ((data
(level 0))) rand (NIL) nan? ((x)) rand-float (NIL) void (rest) cons? ((value)) vm-stats (NIL) rand-double (NIL) * ((num…)) cdr ((lst)) + ((num…)) > ((a . rest))) *doc* #table(>= "Return T if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)." void? "Return T if x is #<void>, NIL otherwise." length= "Bounded length test.\nUse this instead of (= (length lst) n), since it avoids unnecessary\nwork and always terminates." doc-for "Define documentation for a top level term.\nIf the optional doc argument is missing and the term is a function\nsignture, adds it to the documentation." car "Return the first element of a list or NIL if not available." *builtins* "VM instructions as closures." <= "Return T if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)." void "Return the constant #<void> while ignoring any arguments.\n#<void> is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though T or NIL could\nbe returned instead, in case of #<void> alone, REPL will not print\nit." rand "Return a random non-negative fixnum on its maximum range." nan? "Return T if the argument is NaN, regardless of the sign." Instructions "VM instructions mapped to their encoded byte representation." rand-double "Return a random double on [0.0, 1.0] interval." > "Return T if the arguments are in strictly decreasing order (previous\none is greater than the next one)." cdr "Return the tail of a list or NIL if not available." + "Return sum of the numbers or 0 with no arguments." __finish "A function called right before exit by the VM." lz-unpack "Return decompressed data previously compressed using lz-pack.\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified. In the latter case a new\narray is allocated." help "Display documentation for the specified term, if available." defstruct "Defines a structure type with a specific name and slots.\nThe default underlying type is a named vector, ie the first element is\nthe name of the structure type, the rest are the slot values. If the\nname as the first element isn't required, \":named NIL\" should be\nused. A list can be used instead of a vector by adding \":type list\"\noption.\n\nThe option :conc-name specifies the slot accessor prefix, which\ndefaults to \"name-\".\n\nDefault predicate name (\"name?\") can be changed:\n (defstruct blah :predicate blargh? a b c)" rand-u32 "Return a random integer on [0, 2³²-1] interval." = "Return T if the arguments are equal." rand-u64 "Return a random integer on [0, 2⁶⁴-1] interval." add-exit-hook "Puts an one-argument function on top of the list of exit hooks.\nOn shutdown each exit hook is called with the exit status as a single\nargument, which is (usually) 0 on success and any other number on\nerror." /= "Return T if not all arguments are equal. Shorthand for (not (= …))." lz-pack "Return data compressed using Lempel-Ziv.\nThe data must be an array, returned value will have the same type.\nThe optional level is between 0 and 10. With level 0 a simple LZSS\nusing hashing will be performed. Levels between 1 and 9 offer a\ntrade-off between time/space and ratio. Level 10 is optimal but very\nslow." arg-counts "VM instructions mapped to their expected arguments count." rand-float "Return a random float on [0.0, 1.0] interval." *prompt* "Function called by REPL to signal the user input is required.\nDefault function prints \"#;> \"." cons? "Return T if the value is a cons cell." vm-stats "Print various VM-related information, such as the number of GC calls\nso far, heap and stack size, etc." * "Return product of the numbers or 1 with no arguments." *properties* "All properties of symbols recorded with putprop are recorded in this table."))
*syntax-environment* #table(bcode:nconst #fn("n1200r2e3:" #(aref)) doc-for #fn("\x8710002000W1000J60q?140B86;35040<;J404086;35040=863H020212287e212288e2e4e2:20212287e21e3e2:" #(void
- symbol-set-doc quote)) with-input-from #fn("z12021e1220e2e1e12315163:" #(#fn(nconc)
- with-bindings *io-in*
- #fn(copy-list))) unless #fn("z1200q211Pe4:" #(if
+ sym-set-doc quote)) with-input-from #fn("z12021e1220e2e1e12315163:" #(#fn(nconc) with-bindings
+ *io-in* #fn(copy-list))) unless #fn("z1200q211Pe4:" #(if
begin)) defmacro #fn("z170151863D0710<860=5341=?1@30q42223240<e22526e10=e12715153e3e2:" #(value-get-doc
- symbol-set-doc void set-syntax! quote #fn(nconc) λ #fn(copy-list))) time #fn("n1202122e1e2e123024252622e121e32728e5e3e3:" #(let
+ sym-set-doc void set-syntax! quote #fn(nconc) λ #fn(copy-list))) time #fn("n1202122e1e2e123024252622e121e32728e5e3e3:" #(let
#:g352 time-now prog1 princ "Elapsed time: " - " seconds" *linefeed*)) cond #fn("z0Ib520852185>1_51485<061:" #(#0=#fn("z0I:" #() void)
#fn("n10H340q:0<85<20Q;J80485<DQ3C085=J6085<:2185=P:85=J@02285<A<0=51e3:85T23C\x94074758551513c07675855151278685<e2e12886217975855151PA<0=51e4e3:272:85<e2e1282:7585512:e2A<0=51e4e3:2885<2185=PA<0=51e4:" #(else
begin or => 1arg-lambda? caddr caadr let if cddr #:g20) cond-clauses->if))) do #fn("z21<2071052207205220230522425268827872829e12:1=51522829e12:82512825e18:52e153e4e3e2e12825e18952e3:" #(#fn(map)
@@ -42,11 +41,11 @@
#fn("n17002152340q:722324A<25F2605661:" #(member
(:read-only) error #fn(str) "invalid option in slot " " of struct " ": "))) slot-opts)
#fn("n17021062:" #(map! #fn("n10B;35040<85;J404085;35040=;J604qe186RS;J9042086513=071228652@30q4232425268652512087<51390q87P@408762:" #(#fn(keyword?)
- error "invalid slot name: " #fn(list*) #fn(symbol)
- #fn(str) ":"))) tokw) #fn(str?) #fn(length) #fn(map)
- #fn("n10B3500<:0:" #()) #fn(symbol) #fn(str) "?" "make-" "-" #fn(nconc) begin def s and or not
- quote eq? aref = length when symbol-set-doc #fn(copy-list) map-int #fn("n1A<70F05251709205221229386525123872425Ie2e3269424e2e2272825e229242:95510Me37;2<85523O02=2>2?2@86e22A2@96e22Be6e2@B02C242:95510M25e4e4e4:" #(list-ref
- #fn(symbol) #fn(str) def s v assert if void? aref #fn(length) member :read-only error str "slot "
+ error "invalid slot name: " #fn(list*) #fn(sym) #fn(str) ":"))) tokw)
+ #fn(str?) #fn(length) #fn(map) #fn("n10B3500<:0:" #())
+ #fn(sym) #fn(str) "?" "make-" "-" #fn(nconc) begin def s and or not quote eq? aref = length when
+ sym-set-doc #fn(copy-list) map-int #fn("n1A<70F05251709205221229386525123872425Ie2e3269424e2e2272825e229242:95510Me37;2<85523O02=2>2?2@86e22A2@96e22Be6e2@B02C242:95510M25e4e4e4:" #(list-ref
+ #fn(sym) #fn(str) def s v assert if void? aref #fn(length) member :read-only error str "slot "
quote " in struct " " is :read-only" aset!)))) bcode:ctable #fn("n1200Ke3:" #(aref)) with-output-to #fn("z12021e1220e2e1e12315163:" #(#fn(nconc)
with-bindings *io-out* #fn(copy-list))) catch #fn("n22012122e123242522e2262722e22829e2e3262:22e20e3e42;22e22<22e2e4e3e3:" #(trycatch
λ #:g347 if and cons? eq? car quote thrown-value cadr caddr raise)) let* #fn("z10H3E02021e1qe12215153e1:2021e173051e1e1220=B3H02024e10=e12215153e1@301515375051e2:" #(#fn(nconc)
@@ -55,7 +54,7 @@
#fn(copy-list) void)) /= #fn("z1202122e10e12315153e2:" #(not #fn(nconc) = #fn(copy-list))) bcode:sp #fn("n1200r4e3:" #(aref)) bcode:stack #fn("n2200r421220e21e3e4:" #(aset!
+ bcode:sp)) assert #fn("n1200D2122230e2e2e2e4:" #(if raise quote assert-failed)) case #fn("z1Ib6208621_514225023870e2e12425e126278687>215252e3:" #(#0#
#fn("n2120C5020:1J40q:1R3=021072151e3:1H3=023072151e3:1=J>0230721<51e3:74751523=0260271e2e3:280271e2e3:" #(else
- eq? quote-value eqv? every symbol? memq quote memv) vals->cond)
+ eq? quote-value eqv? every sym? memq quote memv) vals->cond)
#fn(gensym) let #fn(nconc) cond #fn(map) #fn("n1A<F0<520=P:" #()))) receive #fn("z22021q1e32221e10e123825153e3:" #(call-with-values
λ #fn(nconc) #fn(copy-list))) unwind-protect #fn("n2202122q1e3e2e1232402225e121e12625e2e4e321e1e3e3:" #(let
#:g348 λ prog1 trycatch #:g349 raise)) dotimes #fn("z10<0T20E2187Ke32223e186e1e12415153e4:" #(for
@@ -65,7 +64,7 @@
<= #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:" #())) >=)
- Instructions #table(call.l #byte(0x51) trycatch #byte(0x4b) loadg.l #byte(0x44) aref2 #byte(0x17) box #byte(0x32) cadr #byte(0x24) argc #byte(0x3e) setg #byte(0x47) load0 #byte(0x15) nan? #byte(0x26) fixnum? #byte(0x29) loadc0 #byte(0x11) loada0 #byte(0x0) div0 #byte(0x3b) keyargs #byte(0x1f) call #byte(0x5) loada.l #byte(0x45) num? #byte(0x28) sub2 #byte(0x4e) add2 #byte(0x1d) loadc.l #byte(0x46) loadc #byte(0x9) builtin? #byte(0x2b) set-car! #byte(0x2f) vargc.l #byte(0x50) vec #byte(0x3f) ret #byte(0xa) loadi8 #byte(0x42) tapply #byte(0x4d) loadvoid #byte(0x19) loada1 #byte(0x1) shift #byte(0x2e) atom? #byte(0x18) cdr #byte(0xd) brne.l #byte(0x53) / #byte(0x3a) equal? #byte(0x34) apply #byte(0x36) dup #byte(0xb) loadt #byte(0x14) jmp.l #byte(0x30) = #byte(0x3c) not #byte(0x23) set-cdr! #byte(0x1e) fn? #byte(0x2c) eq? #byte(0x21) * #byte(0x39) load1 #byte(0x1b) bound? #byte(0x2a) box.l #byte(0x56) < #byte(0x1c) brnn.l #byte(0x54) jmp #byte(0x10) loadv #byte(0x2) for #byte(0x4c) dummy_eof #byte(0x58) + #byte(0x37) brne #byte(0x13) argc.l #byte(0x4f) compare #byte(0x3d) brn #byte(0x3) neg #byte(0x25) loadv.l #byte(0x43) vargc #byte(0x4a) brbound #byte(0x27) loadc1 #byte(0x16) setg.l #byte(0x48) cons? #byte(0x12) aref #byte(0x55) symbol? #byte(0x22) aset! #byte(0x40) car #byte(0xc) cons #byte(0x20) tcall.l #byte(0x52) - #byte(0x38) brn.l #byte(0x31) optargs #byte(0x57) closure #byte(0xe) vec? #byte(0x2d) pop #byte(0x4) eqv? #byte(0x33) list #byte(0x35) seta #byte(0xf) seta.l #byte(0x49) brnn #byte(0x1a) loadnil #byte(0x41) loadg #byte(0x7) loada #byte(0x8) tcall #byte(0x6))
+ Instructions #table(call.l #byte(0x51) trycatch #byte(0x4b) loadg.l #byte(0x44) aref2 #byte(0x17) box #byte(0x32) cadr #byte(0x24) argc #byte(0x3e) setg #byte(0x47) load0 #byte(0x15) nan? #byte(0x26) fixnum? #byte(0x29) loadc0 #byte(0x11) loada0 #byte(0x0) div0 #byte(0x3b) keyargs #byte(0x1f) call #byte(0x5) loada.l #byte(0x45) num? #byte(0x28) sub2 #byte(0x4e) add2 #byte(0x1d) loadc.l #byte(0x46) loadc #byte(0x9) builtin? #byte(0x2b) set-car! #byte(0x2f) vargc.l #byte(0x50) vec #byte(0x3f) ret #byte(0xa) loadi8 #byte(0x42) tapply #byte(0x4d) loadvoid #byte(0x19) loada1 #byte(0x1) shift #byte(0x2e) atom? #byte(0x18) cdr #byte(0xd) brne.l #byte(0x53) / #byte(0x3a) equal? #byte(0x34) apply #byte(0x36) dup #byte(0xb) loadt #byte(0x14) jmp.l #byte(0x30) = #byte(0x3c) not #byte(0x23) set-cdr! #byte(0x1e) fn? #byte(0x2c) eq? #byte(0x21) * #byte(0x39) load1 #byte(0x1b) bound? #byte(0x2a) box.l #byte(0x56) < #byte(0x1c) brnn.l #byte(0x54) jmp #byte(0x10) loadv #byte(0x2) for #byte(0x4c) dummy_eof #byte(0x58) + #byte(0x37) brne #byte(0x13) argc.l #byte(0x4f) compare #byte(0x3d) brn #byte(0x3) neg #byte(0x25) loadv.l #byte(0x43) vargc #byte(0x4a) brbound #byte(0x27) loadc1 #byte(0x16) setg.l #byte(0x48) cons? #byte(0x12) aref #byte(0x55) sym? #byte(0x22) aset! #byte(0x40) car #byte(0xc) cons #byte(0x20) tcall.l #byte(0x52) - #byte(0x38) brn.l #byte(0x31) optargs #byte(0x57) closure #byte(0xe) vec? #byte(0x2d) pop #byte(0x4) eqv? #byte(0x33) list #byte(0x35) seta #byte(0xf) seta.l #byte(0x49) brnn #byte(0x1a) loadnil #byte(0x41) loadg #byte(0x7) loada #byte(0x8) tcall #byte(0x6))
__finish #fn("n120210>17262:" #(#fn(for-each)
#fn("n10A61:" #()) *exit-hooks*) __finish)
__init_globals #fn("n07021d37022@402384w4^147025d;350426;J50427w8429w:4qw;47<w=47>w?47@wA:" #(*os-name*
@@ -86,7 +85,7 @@
#fn(exit)) __start)
abs #fn("n10EL23500U:0:" #() abs) add-exit-hook
#fn("n1070Pw047160:" #(*exit-hooks* void) add-exit-hook) any #fn("n21B;3D0401<51;J:047001=62:" #(any) any)
- arg-counts #table(bound? 1 symbol? 1 car 1 cons 2 cadr 1 nan? 1 for 3 fixnum? 1 cdr 1 atom? 1 div0 2 vec? 1 equal? 2 eqv? 2 compare 2 not 1 set-cdr! 2 num? 1 fn? 1 eq? 2 builtin? 1 cons? 1 set-car! 2)
+ arg-counts #table(bound? 1 sym? 1 car 1 cons 2 cadr 1 nan? 1 for 3 fixnum? 1 cdr 1 atom? 1 div0 2 vec? 1 equal? 2 eqv? 2 compare 2 not 1 set-cdr! 2 num? 1 fn? 1 eq? 2 builtin? 1 cons? 1 set-car! 2)
argc-error #fn("n2702102211Kl237023@402465:" #(error "compile error: " " expects " " argument."
" arguments.") argc-error)
arr? #fn("n10];JF042005185B;390485<21Q:" #(#fn(typeof) arr) arr?) assoc
@@ -107,7 +106,7 @@
splice-form? lastcdr #fn(map) #fn("n1700A62:" #(bq-bracket1))
#fn(nconc) list* #fn("n20J;02071151P:0B3o00<22CX020731AEl23700=@C07425e2760=AK~52e252P:F<0=770<A521P62:2071760A521P51P:" #(nconc
reverse! unquote nreconc list 'unquote bq-process bq-bracket))) bq-process)
- builtin->instruction #fn("n120A0q63:" #(#fn(get)) #(#table(#.cadr cadr #.aset! aset! #.+ + #.- - #.equal? equal? #.eq? eq? #.builtin? builtin? #.not not #.cons? cons? #.cdr cdr #./ / #.div0 div0 #.set-car! set-car! #.vec vec #.set-cdr! set-cdr! #.< < #.aref aref #.for for #.cons cons #.apply apply #.eqv? eqv? #.vec? vec? #.list list #.car car #.bound? bound? #.nan? nan? #.fn? fn? #.symbol? symbol? #.compare compare #.fixnum? fixnum? #.atom? atom? #.= = #.num? num? #.* *)))
+ builtin->instruction #fn("n120A0q63:" #(#fn(get)) #(#table(#.cadr cadr #.aset! aset! #.+ + #.- - #.equal? equal? #.eq? eq? #.builtin? builtin? #.not not #.cons? cons? #.cdr cdr #./ / #.div0 div0 #.set-car! set-car! #.vec vec #.set-cdr! set-cdr! #.< < #.aref aref #.for for #.cons cons #.apply apply #.eqv? eqv? #.vec? vec? #.list list #.car car #.bound? bound? #.nan? nan? #.fn? fn? #.sym? sym? #.compare compare #.fixnum? fixnum? #.atom? atom? #.= = #.num? num? #.* *)))
caaaar #fn("n10<<<<:" #() caaaar) caaadr
#fn("n10T<<:" #() caaadr) caaar #fn("n10<<<:" #() caaar) caadar
#fn("n10<T<:" #() caadar) caaddr #fn("n10=T<:" #() caaddr) caadr
@@ -157,7 +156,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 lambda? lambda:vars compile-set! trycatch 1arg-lambda? caddr "trycatch: second form must be a 1-argument lambda") compile-in)
+ sym-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)
@@ -233,6 +232,8 @@
foldl #fn("n382J401:700082<15282=63:" #(foldl) foldl) foldr
#fn("n382J401:082<700182=5362:" #(foldr) foldr) get-defined-vars #fn("n170A<05161:" #(delete-duplicates) #(#2=(#fn("n10H340q:0<20Cj00=B3d00TR;37040Te1;JS040TB;3E0471051R;3:0471051e1;J404q:0<22C?07324A<0=52}2:q:" #(def
caadr begin nconc #fn(map)) #(#2#)))))
+ get-syntax #fn("n120710q63:" #(#fn(get)
+ *syntax-environment*) get-syntax)
getprop #fn("\x8720003000W2000J60q?2420711q5387;3<04208708253;J50482:" #(#fn(get)
*properties*) getprop)
hex5 #fn("n170210r@52r52263:" #(str-lpad #fn(num->str) #\0) hex5) identity
@@ -240,7 +241,7 @@
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:" #(lambda?
- list? every symbol? length> 255 length= #fn(length)) inlineable?)
+ list? every sym? length> 255 length= #fn(length)) inlineable?)
io-readall #fn("n1205021850524228561:" #(#fn(buffer)
#fn(io-copy)
#fn(io->str)) io-readall)
@@ -247,11 +248,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)
- keyword->symbol #fn("n1200513K021220512386K24865153^161:0:" #(#fn(keyword?)
- #fn(symbol)
- #fn(str)
- #fn(str-sub)
- #fn(str-length)) keyword->symbol)
+ keyword->sym #fn("n1200513K021220512386K24865153^161:0:" #(#fn(keyword?)
+ #fn(sym)
+ #fn(str)
+ #fn(str-sub)
+ #fn(str-length)) keyword->sym)
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
@@ -259,7 +260,7 @@
caar "compile error: invalid optional argument " " in list " #fn(keyword?)
": keyword arguments must come last." "compile error: invalid formal argument ") check-formals)
#fn(map)
- #fn("n10B390700<61:0:" #(keyword->symbol))
+ #fn("n10B390700<61:0:" #(keyword->sym))
to-proper) lambda-vars)
lambda:body #fn("n170061:" #(caddr) lambda:body) lambda:vars
#fn("n1700T61:" #(lambda-vars) lambda:vars) lambda? #fn("n1020Q;J704020Q:" #(λ) lambda?)
@@ -279,7 +280,7 @@
#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 lambda? #fn(nconc) λ lastcdr #fn(map)) lower-define)
- macrocall? #fn("n10<R;3904700<61:" #(symbol-syntax) macrocall?) macroexpand
+ macrocall? #fn("n10<R;3904700<61:" #(get-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))
caar begin #fn(append) cdar) splice-begin) *expanded* #fn("n20H3400:A<201523:0F<051@300A<21152873;0728651@30q2324758852152b987JA024269289>28662:Ib:8:278:928993>4_48:<^186518:I8;B3c0493<788;51QJC08;92<8;<89<52_@;08;798;51_48;=?;@\xfb/48::" #(begin
@@ -291,7 +292,7 @@
#fn("n20T7005171051A<0T5122237489521522225e1F<868:52e192<888:528764:" #(lastcdr cddr #fn(nconc)
#fn(map) list λ) expand-lambda)
#fn("n20=S;J6040TH3o070051J400:0T717005151873B00=?0472868752@30q42386A<74051152e3:750517605170051718851F<86512728798:52152893E088=?847287898653@30q42723e18792<868;52Pe193<888;5263:" #(cddr
- value-get-doc symbol-set-doc def caddr cdadr caadr #fn(nconc)
+ value-get-doc sym-set-doc def caddr cdadr caadr #fn(nconc)
#fn(map) list) expand-define) #fn("n20T20A<71051222324F1>2865215252P:" #(begin cddr #fn(nconc)
#fn(map)
#fn("n10<70A<0TF525150Fe3:" #(compile-thunk))) expand-let-syntax)
@@ -407,11 +408,9 @@
1-) trim-end)
#fn(str-length)
#fn(str-sub)) str-trim)
- symbol-set-doc #fn("z213=070021153@30q482B3\\072023q53742587>18252700232687885253^1^1@30q47760:" #(putprop
+ sym-set-doc #fn("z213=070021153@30q482B3\\072023q53742587>18252700232687885253^1^1@30q47760:" #(putprop
*doc* getprop *funvars* filter #fn("n1700A52S:" #(member))
- #fn(append) void) symbol-set-doc)
- symbol-syntax #fn("n120710q63:" #(#fn(get)
- *syntax-environment*) symbol-syntax)
+ #fn(append) void) sym-set-doc)
table-clone #fn("n12050212285>1q053485:" #(#fn(table)
#fn(table-foldl)
#fn("n320A0163:" #(#fn(put!)))) table-clone)
--- a/src/builtins.c
+++ b/src/builtins.c
@@ -142,12 +142,12 @@
sl_exit(nargs > 0 ? tofixnum(args[0]) : 0);
}
-BUILTIN("symbol", symbol)
+BUILTIN("sym", sym)
{
argcount(nargs, 1);
if(sl_unlikely(!sl_isstr(args[0])))
type_error("str", args[0]);
- return symbol(cvalue_data(args[0]), true);
+ return mk_sym(cvalue_data(args[0]), true);
}
sl_purefn
@@ -154,7 +154,7 @@
BUILTIN("keyword?", keywordp)
{
argcount(nargs, 1);
- return (issymbol(args[0]) && iskeyword((sl_sym*)ptr(args[0]))) ? sl_t : sl_nil;
+ return (issym(args[0]) && iskeyword((sl_sym*)ptr(args[0]))) ? sl_t : sl_nil;
}
sl_purefn
@@ -161,7 +161,7 @@
BUILTIN("top-level-value", top_level_value)
{
argcount(nargs, 1);
- sl_sym *sym = tosymbol(args[0]);
+ sl_sym *sym = tosym(args[0]);
if(sym->binding == UNBOUND)
unbound_error(args[0]);
return sym->binding;
@@ -170,7 +170,7 @@
BUILTIN("set-top-level-value!", set_top_level_value)
{
argcount(nargs, 2);
- sl_sym *sym = tosymbol(args[0]);
+ sl_sym *sym = tosym(args[0]);
if(!isconstant(sym))
sym->binding = args[1];
return args[1];
@@ -179,7 +179,7 @@
BUILTIN("makunbound", makunbound)
{
argcount(nargs, 1);
- sl_sym *sym = tosymbol(args[0]);
+ sl_sym *sym = tosym(args[0]);
if(!isconstant(sym))
sym->binding = UNBOUND;
return sl_void;
@@ -205,7 +205,7 @@
BUILTIN("constant?", constantp)
{
argcount(nargs, 1);
- if(issymbol(args[0]))
+ if(issym(args[0]))
return isconstant((sl_sym*)ptr(args[0])) ? sl_t : sl_nil;
if(iscons(args[0])){
if(car_(args[0]) == sl_quote)
--- a/src/compiler.lsp
+++ b/src/compiler.lsp
@@ -151,7 +151,7 @@
;; variables
-(def (vinfo sym heap? index) (list sym heap? index))
+(def (vinfo symbol heap? index) (list symbol heap? index))
(def vinfo:sym car)
(def vinfo:heap? cadr)
(def vinfo:index caddr)
@@ -158,12 +158,12 @@
(def (quoted? e) (eq? (car e) 'quote))
-(def (capture-var! g sym)
+(def (capture-var! g s)
(let ((ce (bcode:cenv g)))
- (let ((n (index-of sym ce 0)))
+ (let ((n (index-of s ce 0)))
(or n
(prog1 (length ce)
- (aset! g 3 (nconc ce (list sym))))))))
+ (aset! g 3 (nconc ce (list s))))))))
(def (index-of item lst start)
(cond ((not lst) nil)
@@ -351,7 +351,7 @@
(def builtin->instruction
(let ((b2i (table num? 'num? cons 'cons
fixnum? 'fixnum? equal? 'equal?
- eq? 'eq? symbol? 'symbol?
+ eq? 'eq? sym? 'sym?
div0 'div0 builtin? 'builtin?
aset! 'aset! - '- not 'not
apply 'apply atom? 'atom? nan? 'nan?
@@ -408,7 +408,7 @@
(and (cons? lam)
(lambda? (car lam))
(list? (cadr lam))
- (every symbol? (cadr lam))
+ (every sym? (cadr lam))
(not (length> (cadr lam) 255))
(length= (cadr lam) (length (cdr form))))))
@@ -433,7 +433,7 @@
(def (compile-app g env tail? x)
(let ((head (car x)))
(let ((head
- (if (and (symbol? head)
+ (if (and (sym? head)
(not (in-env? head env))
(bound? head)
(builtin? (top-level-value head)))
@@ -474,7 +474,7 @@
(def (fits-i8 x) (and (fixnum? x) (>= 127 x -128)))
(def (compile-in g env tail? x (outl nil))
- (cond ((symbol? x) (compile-sym g env x t))
+ (cond ((sym? x) (compile-sym g env x t))
((atom? x)
(cond ((eq? x 0) (emit g 'load0))
((eq? x 1) (emit g 'load1))
@@ -485,7 +485,7 @@
(else (emit g 'loadv x))))
((eq? (car x) 'aset!)
(compile-aset! g env (cdr x)))
- ((or (not (symbol? (car x))) (bound? (car x)) (in-env? (car x) env))
+ ((or (not (sym? (car x))) (bound? (car x)) (in-env? (car x) env))
(compile-app g env tail? x))
(else
(case (car x)
@@ -510,13 +510,13 @@
(set! (let* ((name (cadr x))
(value (cddr x))
(doc (value-get-doc value)))
- (unless (symbol? name)
+ (unless (sym? name)
(error "set!: name must be a symbol"))
(when doc
(set! value (cdr value))
- (symbol-set-doc name doc (and (cons? (car value))
- (lambda? (car (car value)))
- (lambda:vars (car value)))))
+ (sym-set-doc name doc (and (cons? (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)))
(unless (1arg-lambda? (caddr x))
@@ -528,16 +528,16 @@
;; optional and keyword args
(def (keyword-arg? x) (and (cons? x) (keyword? (car x))))
-(def (keyword->symbol k)
+(def (keyword->sym k)
(if (keyword? k)
- (symbol (let ((s (str k)))
- (str-sub s 1 (str-length s))))
+ (sym (let ((s (str k)))
+ (str-sub s 1 (str-length s))))
k))
(def (lambda-vars l)
(def (check-formals l o opt kw)
- (cond ((or (not l) (symbol? l)) t)
- ((and (cons? l) (symbol? (car l)))
+ (cond ((or (not l) (sym? l)) t)
+ ((and (cons? l) (sym? (car l)))
(if (or opt kw)
(error "compile error: invalid argument list "
o ": optional arguments must come after required.")
@@ -544,7 +544,7 @@
(check-formals (cdr l) o opt kw)))
((and (cons? l) (cons? (car l)))
(unless (and (length= (car l) 2)
- (symbol? (caar l)))
+ (sym? (caar l)))
(error "compile error: invalid optional argument " (car l)
" in list " o))
(if (keyword? (caar l))
@@ -562,7 +562,7 @@
(error "compile error: invalid formal argument " l
" in list " o)))))
(check-formals l l nil nil)
- (map (λ (s) (if (cons? s) (keyword->symbol (car s)) s))
+ (map (λ (s) (if (cons? s) (keyword->sym (car s)) s))
(to-proper l)))
(def (emit-optional-arg-inits g env opta vars i)
@@ -584,10 +584,10 @@
(let* ((form (cadr x))
(body (if (cons? (cddr x))
(cddr x)
- (if (symbol? form)
+ (if (sym? form)
#.void
(error "compile error: invalid syntax " (print-to-str x))))))
- (if (symbol? form)
+ (if (sym? form)
`(#.void (set! ,form ,(car body)))
`(#.void (set! ,(car form)
(λ ,(cdr form) ,@body . ,(car form)))))))
@@ -598,10 +598,10 @@
(cond ((atom? expr) ())
((and (eq? (car expr) 'def)
(cons? (cdr expr)))
- (or (and (symbol? (cadr expr))
+ (or (and (sym? (cadr expr))
(list (cadr expr)))
(and (cons? (cadr expr))
- (symbol? (caadr expr))
+ (sym? (caadr expr))
(list (caadr expr)))
()))
((eq? (car expr) 'begin)
@@ -645,7 +645,7 @@
;; bindings that are both captured and set!'d
(def (complex-bindings- e vars head nested capt setd)
(cond ((not vars) nil)
- ((symbol? e)
+ ((sym? e)
(when (and nested (memq e vars))
(put! capt e t)))
((or (atom? e) (quoted? e)) nil)
--- a/src/compress.c
+++ b/src/compress.c
@@ -73,6 +73,6 @@
void
compress_init(void)
{
- sl_sizesym = csymbol(":size");
- sl_tosym = csymbol(":to");
+ sl_sizesym = mk_csym(":size");
+ sl_tosym = mk_csym(":to");
}
--- a/src/cvalues.c
+++ b/src/cvalues.c
@@ -503,7 +503,7 @@
{
sl_sym *s;
- if(issymbol(type) && (s = ptr(type)) != nil && valid_numtype(s->numtype))
+ if(issym(type) && (s = ptr(type)) != nil && valid_numtype(s->numtype))
return s->size;
if(iscons(type)){
@@ -551,7 +551,7 @@
BUILTIN("sizeof", sizeof)
{
argcount(nargs, 1);
- if(issymbol(args[0]) || iscons(args[0]))
+ if(issym(args[0]) || iscons(args[0]))
return size_wrap(ctype_sizeof(args[0]));
usize n;
u8int *data;
@@ -566,7 +566,7 @@
switch(tag(args[0])){
case TAG_CONS: return sl_conssym;
case TAG_NUM1: case TAG_NUM: return sl_fixnumsym;
- case TAG_SYM: return sl_symbolsym;
+ case TAG_SYM: return sl_symsym;
case TAG_VEC: return sl_vecsym;
case TAG_FN:
if(args[0] == sl_t)
@@ -778,7 +778,7 @@
BUILTIN("builtin", builtin)
{
argcount(nargs, 1);
- sl_sym *s = tosymbol(args[0]);
+ sl_sym *s = tosym(args[0]);
if(!iscbuiltin(s->binding))
lerrorf(sl_errarg, "function \"%s\" not found", s->name);
return s->binding;
@@ -793,7 +793,7 @@
cv->type = sl_builtintype;
cv->cbuiltin = f;
- sl_v sym = symbol(name, false);
+ sl_v sym = mk_sym(name, false);
sl_sym *s = ptr(sym);
s->binding = tagptr(cv, TAG_CVALUE);
ptrhash_put(&slg.reverse_dlsym_lookup, cv, (void*)sym);
@@ -803,7 +803,7 @@
#define cv_intern(tok) \
do{ \
- sl_##tok##sym = csymbol(#tok); \
+ sl_##tok##sym = mk_csym(#tok); \
}while(0)
#define ctor_cv_intern(tok, nt, ctype) \
@@ -1323,10 +1323,10 @@
ctor_cv_intern(arr, NONNUMERIC, int);
- sl_strtypesym = csymbol("*str-type*");
+ sl_strtypesym = mk_csym("*str-type*");
setc(sl_strtypesym, mk_list2(sl_arrsym, sl_bytesym));
- sl_runestrtypesym = csymbol("*runestr-type*");
+ sl_runestrtypesym = mk_csym("*runestr-type*");
setc(sl_runestrtypesym, mk_list2(sl_arrsym, sl_runesym));
mk_primtype(s8, s8int);
@@ -1347,7 +1347,7 @@
sl_mptype->init = cvalue_mp_init;
sl_mptype->vtable = &mp_vtable;
- sl_strtype = get_type(symbol_value(sl_strtypesym));
+ sl_strtype = get_type(sym_value(sl_strtypesym));
sl_emptystr = cvalue_from_ref(sl_strtype, (char*)"", 0);
- sl_runestrtype = get_type(symbol_value(sl_runestrtypesym));
+ sl_runestrtype = get_type(sym_value(sl_runestrtypesym));
}
--- a/src/docs_extra.lsp
+++ b/src/docs_extra.lsp
@@ -7,8 +7,8 @@
term))
(callvars (and call (cdr term))))
(if call
- `(void (symbol-set-doc ',sym ,doc ',callvars))
- `(void (symbol-set-doc ',sym ,doc)))))
+ `(void (sym-set-doc ',sym ,doc ',callvars))
+ `(void (sym-set-doc ',sym ,doc)))))
(doc-for (= a . rest)
"Return T if the arguments are equal.")
--- a/src/equal.c
+++ b/src/equal.c
@@ -100,7 +100,7 @@
return fixnum(1);
if(tagb > TAG_SYM)
return fixnum(-1);
- return fixnum(strcmp(symbol_name(a), symbol_name(b)));
+ return fixnum(strcmp(sym_name(a), sym_name(b)));
case TAG_VEC:
if(isvec(b))
return bounded_vec_compare(a, b, bound, eq);
--- a/src/io.c
+++ b/src/io.c
@@ -147,7 +147,7 @@
{
if(nargs > 1)
argcount(nargs, 1);
- sl_v a = nargs == 0 ? symbol_value(sl_ioinsym) : args[0];
+ sl_v a = nargs == 0 ? sym_value(sl_ioinsym) : args[0];
sl_gc_handle(&a);
sl_v v = sl_read_sexpr(a);
sl_free_gc_handles(1);
@@ -265,7 +265,7 @@
if(nargs < 1 || nargs > 2)
argcount(nargs, 1);
sl_ios *s;
- s = nargs == 2 ? toio(args[1]) : toio(symbol_value(sl_iooutsym));
+ s = nargs == 2 ? toio(args[1]) : toio(sym_value(sl_iooutsym));
sl_print(s, args[0]);
return args[0];
}
@@ -470,20 +470,20 @@
void
io_init(void)
{
- sl_iosym = csymbol("io");
- sl_rdsym = csymbol(":read");
- sl_wrsym = csymbol(":write");
- sl_apsym = csymbol(":append");
- sl_crsym = csymbol(":create");
- sl_truncsym = csymbol(":truncate");
- sl_nonesym = csymbol(":none");
- sl_linesym = csymbol(":line");
- sl_blocksym = csymbol(":block");
- sl_memorysym = csymbol(":memory");
- sl_ioinsym = csymbol("*io-in*");
- sl_iooutsym = csymbol("*io-out*");
+ sl_iosym = mk_csym("io");
+ sl_rdsym = mk_csym(":read");
+ sl_wrsym = mk_csym(":write");
+ sl_apsym = mk_csym(":append");
+ sl_crsym = mk_csym(":create");
+ sl_truncsym = mk_csym(":truncate");
+ sl_nonesym = mk_csym(":none");
+ sl_linesym = mk_csym(":line");
+ sl_blocksym = mk_csym(":block");
+ sl_memorysym = mk_csym(":memory");
+ sl_ioinsym = mk_csym("*io-in*");
+ sl_iooutsym = mk_csym("*io-out*");
sl_iotype = define_opaque_type(sl_iosym, sizeof(sl_ios), &io_vtable, nil);
- set(csymbol("*stdout*"), cvalue_from_ref(sl_iotype, ios_stdout, sizeof(sl_ios)));
- set(csymbol("*stderr*"), cvalue_from_ref(sl_iotype, ios_stderr, sizeof(sl_ios)));
- set(csymbol("*stdin*"), cvalue_from_ref(sl_iotype, ios_stdin, sizeof(sl_ios)));
+ set(mk_csym("*stdout*"), cvalue_from_ref(sl_iotype, ios_stdout, sizeof(sl_ios)));
+ set(mk_csym("*stderr*"), cvalue_from_ref(sl_iotype, ios_stderr, sizeof(sl_ios)));
+ set(mk_csym("*stdin*"), cvalue_from_ref(sl_iotype, ios_stdin, sizeof(sl_ios)));
}
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -15,8 +15,8 @@
[OP_ATOMP] = {"atom?", 1},
[OP_NOT] = {"not", 1},
[OP_LIST] = {"list", ANYARGS},
- [OP_CONS] = {"cons", 2},
[OP_NUMP] = {"num?", 1},
+ [OP_CONS] = {"cons", 2},
[OP_BOUNDP] = {"bound?", 1},
[OP_LT] = {"<", -1},
[OP_CAR] = {"car", 1},
@@ -25,10 +25,9 @@
[OP_FIXNUMP] = {"fixnum?", 1},
[OP_NUMEQ] = {"=", -1},
[OP_BUILTINP] = {"builtin?", 1},
- [OP_SYMBOLP] = {"symbol?", 1},
[OP_SUB] = {"-", -1},
- [OP_COMPARE] = {"compare", 2},
[OP_VEC] = {"vec", ANYARGS},
+ [OP_COMPARE] = {"compare", 2},
[OP_FOR] = {"for", 3},
[OP_MUL] = {"*", ANYARGS},
[OP_ADD] = {"+", ANYARGS},
@@ -35,4 +34,5 @@
[OP_AREF] = {"aref", -2},
[OP_DIV] = {"/", -1},
[OP_EQUAL] = {"equal?", 2},
+ [OP_SYMP] = {"sym?", 1},
};
--- a/src/opcodes.h
+++ b/src/opcodes.h
@@ -33,7 +33,7 @@
OP_KEYARGS,
OP_CONS,
OP_EQ,
- OP_SYMBOLP,
+ OP_SYMP,
OP_NOT,
OP_CADR,
OP_NEG,
--- a/src/plan9/lsd.c
+++ b/src/plan9/lsd.c
@@ -14,11 +14,11 @@
void
lsd_init(void)
{
- lsd_gpregsym = csymbol(":gpreg");
- lsd_fpregsym = csymbol(":fpreg");
- lsd_symsym = csymbol("sym");
- lsd_regsym = csymbol("reg");
- lsd_framesym = csymbol("frame");
+ lsd_gpregsym = mk_csym(":gpreg");
+ lsd_fpregsym = mk_csym(":fpreg");
+ lsd_symsym = mk_csym("sym");
+ lsd_regsym = mk_csym("reg");
+ lsd_framesym = mk_csym("frame");
}
static Reglist*
@@ -287,7 +287,7 @@
vec_elt(v, 4) = sl_u64sym;
break;
}
- set(symbol(r->rname, 1), v);
+ set(mk_sym(r->rname, true), v);
registers = mk_cons(v, registers);
}
sl_free_gc_handles(2);
--- a/src/plan9/lsd.lsp
+++ b/src/plan9/lsd.lsp
@@ -1,7 +1,7 @@
#!/bin/sl
(defstruct reg name type addr size)
-(defstruct sym name type addr)
+(defstruct symbol name type addr)
(defstruct global text data)
(defstruct frame loc retpc sp locals)
@@ -61,15 +61,16 @@
((:fpreg) fpregsf))))
(io-pread f (reg-addr reg) (list (reg-size reg)))))
-(def (readsym sym . rest)
+(def (readsym symbol . rest)
(unless coref (error "not attached to proc"))
- (apply readcore (cons (sym-addr sym) rest)))
+ (apply readcore (cons (symbol-addr symbol) rest)))
(def (bpset loc)
(if (< pid 0) (error "no running process"))
- (let ((addr (cond ((eq? (typeof loc) 'symbol)
- (sym-addr (get (global-text globals) loc)))
- ((num? loc) (u64 loc))
+ (let ((addr (cond ((sym? loc)
+ (symbol-addr (get (global-text globals) loc)))
+ ((num? loc)
+ (u64 loc))
(else (error "symbol or number")))))
(unless (eq? (status) 'Stopped)
(begin
@@ -102,7 +103,7 @@
(set! pid (aref v 0))
(set! proc-stdin (aref v 1))
(attach)
- (bpset (car (follow (sym-addr (get (global-text globals) 'main)))))
+ (bpset (car (follow (symbol-addr (get (global-text globals) 'main)))))
(startstop)
(set! pids (cons pid pids))
pid))
@@ -109,7 +110,7 @@
(def (load a)
(let* ((v (lsd-load a))
- (f (λ (sym tbl) (put! tbl (symbol (sym-name sym)) sym)))
+ (f (λ (symbol tbl) (put! tbl (sym (symbol-name symbol)) symbol)))
(text (foldl f (table) (aref v 3)))
(data (foldl f (table) (aref v 4))))
(set! pid (aref v 0))
--- a/src/print.c
+++ b/src/print.c
@@ -87,7 +87,7 @@
print_traverse(car_(v));
v = cdr_(v);
}
- if(!ismanaged(v) || issymbol(v))
+ if(!ismanaged(v) || issym(v))
return;
if(ismarked(v)){
bp = (sl_v*)ptrhash_bp(&sl.printconses, (void*)v);
@@ -121,7 +121,7 @@
}
static void
-print_symbol_name(sl_ios *f, const char *name)
+print_sym_name(sl_ios *f, const char *name)
{
int i;
bool escape = false, charescape = false;
@@ -176,8 +176,8 @@
static inline int
tinyp(sl_v v)
{
- if(issymbol(v)){
- const char *s = symbol_name(v);
+ if(issym(v)){
+ const char *s = sym_name(v);
return u8_strwidth(s, strlen(s)) < SMALL_STR_LEN;
}
if(sl_isstr(v))
@@ -225,8 +225,8 @@
lengthestimate(sl_v v)
{
// get the width of an expression if we can do so cheaply
- if(issymbol(v)){
- const char *s = symbol_name(v);
+ if(issym(v)){
+ const char *s = sym_name(v);
return u8_strwidth(s, strlen(s));
}
if(iscprim(v) && ptr(v) != nil && cp_class(ptr(v)) == sl_runetype)
@@ -424,7 +424,7 @@
sl.hpos += n;
break;
case TAG_SYM:
- name = symbol_name(v);
+ name = sym_name(v);
if(sl.print_princ)
outs(f, name);
else if(ismanaged(v)){
@@ -431,7 +431,7 @@
outsn(f, "#:", 2);
outs(f, name);
}else
- print_symbol_name(f, name);
+ print_sym_name(f, name);
break;
case TAG_FN:
if(v == sl_t)
@@ -722,7 +722,7 @@
else
rep = signbit(d) ? "-wtf.0" : "+wtf.0";
if(type == sl_floatsym && !sl.print_princ && !weak){
- n = ios_printf(f, "#%s(%s)", symbol_name(type), rep);
+ n = ios_printf(f, "#%s(%s)", sym_name(type), rep);
if(n < 1)
goto err;
sl.hpos += n;
@@ -748,7 +748,7 @@
u64int ui64 = *(u64int*)data;
n = (weak || sl.print_princ)
? ios_printf(f, "%"PRIu64, ui64)
- : ios_printf(f, "#%s(%"PRIu64")", symbol_name(type), ui64);
+ : ios_printf(f, "#%s(%"PRIu64")", sym_name(type), ui64);
if(n < 1)
goto err;
sl.hpos += n;
@@ -760,7 +760,7 @@
goto err;
sl.hpos += n;
MEM_FREE(s);
- }else if(issymbol(type)){
+ }else if(issym(type)){
// handle other integer prims. we know it's smaller than uint64
// at this point, so int64 is big enough to capture everything.
sl_numtype nt = sym_to_numtype(type);
@@ -768,9 +768,9 @@
s64int i64 = conv_to_s64(data, nt);
n = (weak || sl.print_princ)
? ios_printf(f, "%"PRId64, i64)
- : ios_printf(f, "#%s(%"PRId64")", symbol_name(type), i64);
+ : ios_printf(f, "#%s(%"PRId64")", sym_name(type), i64);
}else{
- n = ios_printf(f, "#<%s>", symbol_name(type));
+ n = ios_printf(f, "#<%s>", sym_name(type));
}
if(n < 1)
goto err;
@@ -857,10 +857,10 @@
label = (sl_v)ptrhash_get(&slg.reverse_dlsym_lookup, cv);
assert(label != (sl_v)HT_NOTFOUND);
if(sl.print_princ){
- outs(f, symbol_name(label));
+ outs(f, sym_name(label));
}else{
outsn(f, "#fn(", 4);
- outs(f, symbol_name(label));
+ outs(f, sym_name(label));
outc(f, ')');
}
}else if(cv_class(cv)->vtable != nil && cv_class(cv)->vtable->print != nil){
@@ -875,7 +875,7 @@
static void
set_print_width(void)
{
- sl_v pw = symbol_value(sl_printwidthsym);
+ sl_v pw = sym_value(sl_printwidthsym);
if(!isfixnum(pw))
return;
sl.scr_width = numval(pw);
@@ -884,13 +884,13 @@
void
sl_print(sl_ios *f, sl_v v)
{
- sl.print_pretty = symbol_value(sl_printprettysym) != sl_nil;
+ sl.print_pretty = sym_value(sl_printprettysym) != sl_nil;
if(sl.print_pretty)
set_print_width();
- sl.print_princ = symbol_value(sl_printreadablysym) == sl_nil;
- sl_v pl = symbol_value(sl_printlengthsym);
+ sl.print_princ = sym_value(sl_printreadablysym) == sl_nil;
+ sl_v pl = sym_value(sl_printlengthsym);
sl.print_length = isfixnum(pl) ? numval(pl) : -1;
- pl = symbol_value(sl_printlevelsym);
+ pl = sym_value(sl_printlevelsym);
sl.print_level = isfixnum(pl) ? numval(pl) : -1;
sl.p_level = 0;
--- a/src/read.c
+++ b/src/read.c
@@ -248,7 +248,7 @@
}
}else if(cval >= 'a' && cval <= 'z'){
read_token(ctx, (char)cval, 0);
- ctx->tokval = symbol(ctx->buf, true);
+ ctx->tokval = mk_sym(ctx->buf, true);
if(ctx->buf[1] == '\0') USED(cval); /* one character */
else if(ctx->tokval == sl_nulsym) cval = 0x00;
else if(ctx->tokval == sl_alarmsym) cval = 0x07;
@@ -346,7 +346,7 @@
}
ctx->toktype = TOK_SHARPSYM;
- ctx->tokval = symbol(ctx->buf, true);
+ ctx->tokval = mk_sym(ctx->buf, true);
}else{
parse_error(&ctx->loc, "unknown read macro");
}
@@ -379,7 +379,7 @@
else if(strcmp(s, "λ") == 0 || strcmp(s, "lambda") == 0)
ctx->tokval = sl_lambda;
else{
- ctx->tokval = symbol(s, true);
+ ctx->tokval = mk_sym(s, true);
if(s[strlen(s)-1] == '#')
ctx->toktype = TOK_GENSYM;
}
@@ -659,7 +659,7 @@
ctx->loc = RS->loc;
if(c != '('){
take(ctx);
- parse_error(&ctx->loc, "expected argument list for %s", symbol_name(ctx->tokval));
+ parse_error(&ctx->loc, "expected argument list for %s", sym_name(ctx->tokval));
}
PUSH(sl_nil);
read_list(ctx, UNBOUND, TOK_CLOSE);
@@ -667,7 +667,7 @@
sym = sl_arrsym;
sl.sp[-1] = mk_cons(sl_u8sym, sl.sp[-1]);
}
- v = symbol_value(sym);
+ v = sym_value(sym);
if(v == UNBOUND)
unbound_error(sym);
return sl_apply(v, POP());
@@ -680,8 +680,8 @@
// (... #2=#.#0# ... ) OK
// (... #2=#.(#2#) ... ) DO NOT WANT
sym = do_read_sexpr(ctx, UNBOUND);
- if(issymbol(sym)){
- v = symbol_value(sym);
+ if(issym(sym)){
+ v = sym_value(sym);
if(v == UNBOUND)
unbound_error(sym);
return v;
@@ -704,7 +704,7 @@
case TOK_GENSYM:
pv = (sl_v*)ptrhash_bp(&sl.readstate->gensyms, (void*)ctx->tokval);
if(*pv == (sl_v)HT_NOTFOUND)
- *pv = gensym();
+ *pv = mk_gensym();
return *pv;
case TOK_DOUBLEQUOTE:
return read_str(ctx);
--- a/src/sl.c
+++ b/src/sl.c
@@ -13,7 +13,7 @@
sl_v sl_builtinssym, sl_quote, sl_lambda, sl_comma, sl_commaat;
sl_v sl_commadot, sl_trycatch, sl_backquote;
-sl_v sl_conssym, sl_symbolsym, sl_fixnumsym, sl_vecsym, sl_builtinsym, sl_vu8sym;
+sl_v sl_conssym, sl_symsym, sl_fixnumsym, sl_vecsym, sl_builtinsym, sl_vu8sym;
sl_v sl_defsym, sl_defmacrosym, sl_forsym, sl_setqsym;
sl_v sl_booleansym, sl_nullsym, sl_evalsym, sl_fnsym, sl_trimsym;
sl_v sl_nulsym, sl_alarmsym, sl_backspacesym, sl_tabsym, sl_linefeedsym, sl_newlinesym;
@@ -71,7 +71,7 @@
{
if(!slg.exiting){
slg.exiting = true;
- sl_applyn(1, symbol_value(symbol("__finish", false)), fixnum(status));
+ sl_applyn(1, sym_value(mk_sym("__finish", false)), fixnum(status));
sl_gc(false);
}
exit(status);
@@ -154,7 +154,7 @@
_Noreturn void
type_error(const char *expected, sl_v got)
{
- sl_raise(mk_listn(3, sl_errtype, symbol(expected, false), got));
+ sl_raise(mk_listn(3, sl_errtype, mk_sym(expected, false), got));
}
_Noreturn void
@@ -186,7 +186,7 @@
type_error(#type, v); \
}
SAFECAST_OP(cons, sl_cons*, ptr)
-SAFECAST_OP(symbol, sl_sym*, ptr)
+SAFECAST_OP(sym, sl_sym*, ptr)
SAFECAST_OP(fixnum, sl_fx, numval)
//SAFECAST_OP(cvalue, csl_v*, ptr)
SAFECAST_OP(str, char*, cvalue_data)
@@ -195,7 +195,7 @@
// symbol table ---------------------------------------------------------------
static sl_sym *
-mk_symbol(const char *str, int len, bool copy)
+alloc_sym(const char *str, int len, bool copy)
{
sl_sym *sym = MEM_ALLOC(sizeof(*sym) + (copy ? len+1 : 0));
sym->numtype = NONNUMERIC;
@@ -220,13 +220,13 @@
}
sl_v
-symbol(const char *str, bool copy)
+mk_sym(const char *str, bool copy)
{
int len = strlen(str);
sl_sym *v;
const char *k;
if(!Tgetkv(slg.symbols, str, len, &k, (void**)&v)){
- v = mk_symbol(str, len, copy);
+ v = alloc_sym(str, len, copy);
slg.symbols = Tsetl(slg.symbols, v->name, len, v);
}
return tagptr(v, TAG_SYM);
@@ -233,9 +233,9 @@
}
sl_v
-csymbol_(const char *str, int len)
+mk_csym_(const char *str, int len)
{
- sl_sym *v = mk_symbol(str, len, false);
+ sl_sym *v = alloc_sym(str, len, false);
slg.symbols = Tsetl(slg.symbols, str, len, v);
return tagptr(v, TAG_SYM);
}
@@ -252,7 +252,7 @@
}
sl_v
-gensym(void)
+mk_gensym(void)
{
return fn_builtin_gensym(nil, 0);
}
@@ -286,7 +286,7 @@
}
const char *
-symbol_name(sl_v v)
+sym_name(sl_v v)
{
if(ismanaged(v)){
sl_gensym *gs = ptr(v);
@@ -576,7 +576,7 @@
else if(isfn(f))
v = apply_cl(n);
else if(sl_likely(isbuiltin(f))){
- sl_v tab = symbol_value(sl_builtinssym);
+ sl_v tab = sym_value(sl_builtinssym);
if(sl_unlikely(ptr(tab) == nil))
unbound_error(tab);
saveSP[-n-1] = vec_elt(tab, uintval(f));
@@ -780,7 +780,7 @@
args[i] = UNBOUND;
for(i = nreq; i < nargs; i++){
v = bp[i];
- if(issymbol(v) && iskeyword((sl_sym*)ptr(v)))
+ if(issym(v) && iskeyword((sl_sym*)ptr(v)))
break;
if(a >= nopt)
goto no_kw;
@@ -793,7 +793,7 @@
do{
i++;
if(sl_unlikely(i >= nargs))
- lerrorf(sl_errarg, "keyword %s requires an argument", symbol_name(v));
+ lerrorf(sl_errarg, "keyword %s requires an argument", sym_name(v));
sl_v hv = fixnum(((sl_sym*)ptr(v))->hash);
sl_fx lx = numval(hv);
uintptr x = 2*((lx < 0 ? -lx : lx) % n);
@@ -806,13 +806,13 @@
args[idx] = bp[i];
}
}else{
- lerrorf(sl_errarg, "unsupported keyword %s", symbol_name(v));
+ lerrorf(sl_errarg, "unsupported keyword %s", sym_name(v));
}
i++;
if(i >= nargs)
break;
v = bp[i];
- }while(issymbol(v) && iskeyword((sl_sym*)ptr(v)));
+ }while(issym(v) && iskeyword((sl_sym*)ptr(v)));
no_kw:
nrestargs = nargs - i;
if(sl_unlikely(!va && nrestargs > 0))
@@ -939,7 +939,7 @@
BUILTIN("fn", fn)
{
- if(nargs == 1 && issymbol(args[0]))
+ if(nargs == 1 && issym(args[0]))
return fn_builtin_builtin(args, nargs);
if(nargs < 2 || nargs > 4)
argcount(nargs, 2);
@@ -963,7 +963,7 @@
fn->env = sl_nil;
fn->name = sl_lambda;
if(nargs > 2){
- if(issymbol(args[2])){
+ if(issym(args[2])){
fn->name = args[2];
if(nargs > 3)
fn->env = args[3];
@@ -970,8 +970,8 @@
}else{
fn->env = args[2];
if(nargs > 3){
- if(sl_unlikely(!issymbol(args[3])))
- type_error("symbol", args[3]);
+ if(sl_unlikely(!issym(args[3])))
+ type_error("sym", args[3]);
fn->name = args[3];
}
}
@@ -1018,7 +1018,7 @@
if(isfn(v))
return fn_name(v);
if(isbuiltin(v))
- return symbol(builtins[uintval(v)].name, false);
+ return mk_sym(builtins[uintval(v)].name, false);
if(iscbuiltin(v)){
v = (sl_v)ptrhash_get(&slg.reverse_dlsym_lookup, ptr(v));
if(v == (sl_v)HT_NOTFOUND)
@@ -1239,62 +1239,62 @@
comparehash_init();
- sl_lambda = csymbol("λ");
- sl_quote = csymbol("quote");
- sl_trycatch = csymbol("trycatch");
- sl_backquote = csymbol("quasiquote");
- sl_comma = csymbol("unquote");
- sl_commaat = csymbol("unquote-splicing");
- sl_commadot = csymbol("unquote-nsplicing");
- sl_errio = csymbol("io-error");
- sl_errparse = csymbol("parse-error");
- sl_errtype = csymbol("type-error");
- sl_errarg = csymbol("arg-error");
- sl_errunbound = csymbol("unbound-error");
- sl_errkey = csymbol("key-error");
- sl_errmem = csymbol("memory-error");
- sl_errbounds = csymbol("bounds-error");
- sl_errdiv0 = csymbol("divide-error");
- sl_err = csymbol("error");
- sl_conssym = csymbol("cons");
- sl_symbolsym = csymbol("symbol");
- sl_fixnumsym = csymbol("fixnum");
- sl_vecsym = csymbol("vec");
- sl_builtinsym = csymbol("builtin");
- sl_booleansym = csymbol("boolean");
- sl_nullsym = csymbol("null");
- sl_defsym = csymbol("def");
- sl_defmacrosym = csymbol("defmacro");
- sl_forsym = csymbol("for");
- sl_setqsym = csymbol("set!");
- sl_evalsym = csymbol("eval");
- sl_vu8sym = csymbol("vu8");
- sl_fnsym = csymbol("fn");
- sl_trimsym = csymbol(":trim");
- sl_nulsym = csymbol("nul");
- sl_alarmsym = csymbol("alarm");
- sl_backspacesym = csymbol("backspace");
- sl_tabsym = csymbol("tab");
- sl_linefeedsym = csymbol("linefeed");
- sl_vtabsym = csymbol("vtab");
- sl_pagesym = csymbol("page");
- sl_returnsym = csymbol("return");
- sl_escsym = csymbol("esc");
- sl_spacesym = csymbol("space");
- sl_deletesym = csymbol("delete");
- sl_newlinesym = csymbol("newline");
- sl_builtinssym = csymbol("*builtins*");
+ sl_lambda = mk_csym("λ");
+ sl_quote = mk_csym("quote");
+ sl_trycatch = mk_csym("trycatch");
+ sl_backquote = mk_csym("quasiquote");
+ sl_comma = mk_csym("unquote");
+ sl_commaat = mk_csym("unquote-splicing");
+ sl_commadot = mk_csym("unquote-nsplicing");
+ sl_errio = mk_csym("io-error");
+ sl_errparse = mk_csym("parse-error");
+ sl_errtype = mk_csym("type-error");
+ sl_errarg = mk_csym("arg-error");
+ sl_errunbound = mk_csym("unbound-error");
+ sl_errkey = mk_csym("key-error");
+ sl_errmem = mk_csym("memory-error");
+ sl_errbounds = mk_csym("bounds-error");
+ sl_errdiv0 = mk_csym("divide-error");
+ sl_err = mk_csym("error");
+ sl_conssym = mk_csym("cons");
+ sl_symsym = mk_csym("symbol");
+ sl_fixnumsym = mk_csym("fixnum");
+ sl_vecsym = mk_csym("vec");
+ sl_builtinsym = mk_csym("builtin");
+ sl_booleansym = mk_csym("boolean");
+ sl_nullsym = mk_csym("null");
+ sl_defsym = mk_csym("def");
+ sl_defmacrosym = mk_csym("defmacro");
+ sl_forsym = mk_csym("for");
+ sl_setqsym = mk_csym("set!");
+ sl_evalsym = mk_csym("eval");
+ sl_vu8sym = mk_csym("vu8");
+ sl_fnsym = mk_csym("fn");
+ sl_trimsym = mk_csym(":trim");
+ sl_nulsym = mk_csym("nul");
+ sl_alarmsym = mk_csym("alarm");
+ sl_backspacesym = mk_csym("backspace");
+ sl_tabsym = mk_csym("tab");
+ sl_linefeedsym = mk_csym("linefeed");
+ sl_vtabsym = mk_csym("vtab");
+ sl_pagesym = mk_csym("page");
+ sl_returnsym = mk_csym("return");
+ sl_escsym = mk_csym("esc");
+ sl_spacesym = mk_csym("space");
+ sl_deletesym = mk_csym("delete");
+ sl_newlinesym = mk_csym("newline");
+ sl_builtinssym = mk_csym("*builtins*");
- set(sl_printprettysym = csymbol("*print-pretty*"), sl_t);
- set(sl_printreadablysym = csymbol("*print-readably*"), sl_t);
- set(sl_printwidthsym = csymbol("*print-width*"), fixnum(sl.scr_width));
- set(sl_printlengthsym = csymbol("*print-length*"), sl_nil);
- set(sl_printlevelsym = csymbol("*print-level*"), sl_nil);
+ set(sl_printprettysym = mk_csym("*print-pretty*"), sl_t);
+ set(sl_printreadablysym = mk_csym("*print-readably*"), sl_t);
+ set(sl_printwidthsym = mk_csym("*print-width*"), fixnum(sl.scr_width));
+ set(sl_printlengthsym = mk_csym("*print-length*"), sl_nil);
+ set(sl_printlevelsym = mk_csym("*print-level*"), sl_nil);
sl.lasterror = sl_nil;
for(i = 0; i < nelem(builtins); i++){
if(builtins[i].name)
- set(symbol(builtins[i].name, false), builtin(i));
+ set(mk_sym(builtins[i].name, false), builtin(i));
}
sl_emptyvec = tagptr(alloc_words(1), TAG_VEC);
@@ -1302,9 +1302,9 @@
cvalues_init();
- set(csymbol("*os-name*"), cvalue_static_cstr(__os_name__));
+ set(mk_csym("*os-name*"), cvalue_static_cstr(__os_name__));
#if defined(__os_version__)
- set(csymbol("*os-version*"), cvalue_static_cstr(__os_version__));
+ set(mk_csym("*os-version*"), cvalue_static_cstr(__os_version__));
#endif
sl_erroom = mk_list2(sl_errmem, cvalue_static_cstr("out of memory"));
@@ -1323,7 +1323,7 @@
sl_v
sl_toplevel_eval(sl_v expr)
{
- return sl_applyn(1, symbol_value(sl_evalsym), expr);
+ return sl_applyn(1, sym_value(sl_evalsym), expr);
}
int
@@ -1345,7 +1345,7 @@
}else{
// stage 1 format: list alternating symbol/value
while(iscons(e)){
- sl_sym *sym = tosymbol(car_(e));
+ sl_sym *sym = tosym(car_(e));
e = cdr_(e);
if(sym->binding != UNBOUND)
ios_printf(ios_stderr, "%s redefined on boot\n", sym->name);
--- a/src/sl.h
+++ b/src/sl.h
@@ -107,7 +107,7 @@
#define uintval(x) (((unsigned int)(x))>>3)
#define builtin(n) tagptr(((sl_v)n<<3), TAG_FN)
#define iscons(x) (tag(x) == TAG_CONS)
-#define issymbol(x) (tag(x) == TAG_SYM)
+#define issym(x) (tag(x) == TAG_SYM)
#define isfixnum(x) (((x)&3) == TAG_NUM)
#define bothfixnums(x, y) (isfixnum(x) && isfixnum(y))
#define isvec(x) (tag(x) == TAG_VEC)
@@ -152,10 +152,10 @@
}while(0)
#define isconstant(s) ((s)->flags & FLAG_CONST)
#define iskeyword(s) ((s)->flags & FLAG_KEYWORD)
-#define symbol_value(s) (((sl_sym*)ptr(s))->binding)
+#define sym_value(s) (((sl_sym*)ptr(s))->binding)
#define sym_to_numtype(s) (((sl_sym*)ptr(s))->numtype)
#define ismanaged(v) ((((u8int*)ptr(v)) >= slg.fromspace) && (((u8int*)ptr(v)) < slg.fromspace+slg.heapsize))
-#define isgensym(x) (issymbol(x) && ismanaged(x))
+#define isgensym(x) (issym(x) && ismanaged(x))
#define isfn(x) (tag(x) == TAG_FN && (x) > (N_BUILTINS<<3))
#define iscbuiltin(x) (iscvalue(x) && cv_class(ptr(x)) == sl_builtintype)
// utility for iterating over all arguments in a builtin
@@ -187,11 +187,11 @@
void sl_free_gc_handles(int n);
/* symbol table */
-sl_v gensym(void);
-sl_v symbol(const char *str, bool copy) sl_hotfn;
-sl_v csymbol_(const char *str, int len);
-#define csymbol(str) csymbol_(str, sizeof(str)-1)
-const char *symbol_name(sl_v v);
+sl_v mk_gensym(void);
+sl_v mk_sym(const char *str, bool copy) sl_hotfn;
+sl_v mk_csym_(const char *str, int len);
+#define mk_csym(str) mk_csym_(str, sizeof(str)-1)
+const char *sym_name(sl_v v);
/* read, eval, print main entry points */
sl_v sl_toplevel_eval(sl_v expr);
@@ -211,7 +211,7 @@
/* safe casts */
sl_cons *tocons(sl_v v) sl_purefn;
-sl_sym *tosymbol(sl_v v) sl_purefn;
+sl_sym *tosym(sl_v v) sl_purefn;
sl_fx tofixnum(sl_v v) sl_purefn;
char *tostr(sl_v v) sl_purefn;
double todouble(sl_v a) sl_purefn;
@@ -413,7 +413,7 @@
extern sl_v sl_builtinssym, sl_quote, sl_lambda, sl_comma, sl_commaat;
extern sl_v sl_commadot, sl_trycatch, sl_backquote;
-extern sl_v sl_conssym, sl_symbolsym, sl_fixnumsym, sl_vecsym, sl_builtinsym, sl_vu8sym;
+extern sl_v sl_conssym, sl_symsym, sl_fixnumsym, sl_vecsym, sl_builtinsym, sl_vu8sym;
extern sl_v sl_defsym, sl_defmacrosym, sl_forsym, sl_setqsym;
extern sl_v sl_booleansym, sl_nullsym, sl_evalsym, sl_fnsym, sl_trimsym;
extern sl_v sl_nulsym, sl_alarmsym, sl_backspacesym, sl_tabsym, sl_linefeedsym, sl_newlinesym;
--- a/src/slmain.c
+++ b/src/slmain.c
@@ -131,7 +131,7 @@
s = value2c(sl_ios*, f);
sl_free_gc_handles(2);
ios_close(s);
- sl_applyn(1, symbol_value(symbol("__start", false)), args);
+ sl_applyn(1, sym_value(mk_sym("__start", false)), args);
r = 0;
}
}
--- a/src/str.c
+++ b/src/str.c
@@ -123,8 +123,8 @@
sl_v arg, buf = fn_builtin_buffer(nil, 0);
sl_gc_handle(&buf);
sl_ios *s = value2c(sl_ios*, buf);
- sl_v oldpr = symbol_value(sl_printreadablysym);
- sl_v oldpp = symbol_value(sl_printprettysym);
+ sl_v oldpr = sym_value(sl_printreadablysym);
+ sl_v oldpp = sym_value(sl_printprettysym);
set(sl_printreadablysym, sl_nil);
set(sl_printprettysym, sl_nil);
int i;
--- a/src/system.lsp
+++ b/src/system.lsp
@@ -22,12 +22,12 @@
(def *syntax-environment* (table)))
(def (set-syntax! s v) (put! *syntax-environment* s v))
-(def (symbol-syntax s) (get *syntax-environment* s nil))
+(def (get-syntax s) (get *syntax-environment* s nil))
(defmacro (defmacro form . body)
(let ((doc (value-get-doc body)))
(when doc
- (symbol-set-doc (car form) doc (cdr form))
+ (sym-set-doc (car form) doc (cdr form))
(set! body (cdr body)))
`(void (set-syntax! ',(car form)
(λ ,(cdr form) ,@body)))))
@@ -40,7 +40,7 @@
(defmacro (let binds . body)
(let ((lname nil))
- (when (symbol? binds)
+ (when (sym? binds)
(set! lname binds)
(set! binds (car body))
(set! body (cdr body)))
@@ -102,38 +102,38 @@
(unless (bound? '*properties*)
(def *properties* (table)))
-(def (putprop sym key val)
+(def (putprop symbol key val)
(let ((kt (get *properties* key nil)))
(unless kt
(let ((ta (table)))
(put! *properties* key ta)
(set! kt ta)))
- (put! kt sym val)
+ (put! kt symbol val)
val))
-(def (getprop sym key (def nil))
+(def (getprop symbol key (def nil))
(let ((kt (get *properties* key nil)))
- (or (and kt (get kt sym def)) def)))
+ (or (and kt (get kt symbol def)) def)))
-(def (remprop sym key)
+(def (remprop symbol key)
(let ((kt (get *properties* key nil)))
- (and kt (has? kt sym) (del! kt sym))))
+ (and kt (has? kt symbol) (del! kt symbol))))
;;; documentation
-(def (symbol-set-doc sym doc . funvars)
+(def (sym-set-doc symbol doc . funvars)
(when doc
- (putprop sym '*doc* doc))
+ (putprop symbol '*doc* doc))
(when (cons? funvars)
- (let* {[existing (getprop sym '*funvars* nil)]
+ (let* {[existing (getprop symbol '*funvars* nil)]
; filter out duplicates
[to-add (filter (λ (funvar) (not (member funvar existing)))
funvars)]}
- (putprop sym '*funvars* (append existing to-add))))
+ (putprop symbol '*funvars* (append existing to-add))))
(void))
-;; chicken and egg - properties defined before symbol-set-doc
-(symbol-set-doc
+;; chicken and egg - properties defined before sym-set-doc
+(sym-set-doc
'*properties*
"All properties of symbols recorded with putprop are recorded in this table.")
@@ -492,9 +492,9 @@
(def (self-evaluating? x)
(and (not (gensym? x))
(or (and (atom? x)
- (not (symbol? x)))
+ (not (sym? x)))
(and (constant? x)
- (symbol? x)
+ (sym? x)
(eq? x (top-level-value x))))))
(defmacro (quasiquote x) (bq-process x 0))
@@ -535,7 +535,7 @@
(else (list list (bq-process x d)))))
(def (bq-process x d)
- (cond ((symbol? x) (list 'quote x))
+ (cond ((sym? x) (list 'quote x))
((vec? x)
(let ((body (bq-process (vec->list x) d)))
(if (eq? (car body) list)
@@ -601,10 +601,10 @@
(def (vals->cond key v)
(cond ((eq? v 'else) 'else)
((not v) nil)
- ((symbol? v) `(eq? ,key ,(quote-value v)))
+ ((sym? v) `(eq? ,key ,(quote-value v)))
((atom? v) `(eqv? ,key ,(quote-value v)))
((not (cdr v)) `(eqv? ,key ,(quote-value (car v))))
- ((every symbol? v)
+ ((every sym? v)
`(memq ,key ',v))
(else `(memv ,key ',v))))
(let ((g (gensym)))
@@ -701,21 +701,21 @@
(equal? (fn-code f)
(fn-code sample-traced-lambda))))))
-(def (trace sym)
- (let ((func (top-level-value sym)))
+(def (trace symbol)
+ (let ((func (top-level-value symbol)))
(when (not (traced? func))
- (set-top-level-value! sym
+ (set-top-level-value! symbol
(eval
`(λ args#
- (write (cons ',sym args#))
+ (write (cons ',symbol args#))
(newline)
(apply ',func args#))))))
(void))
-(def (untrace sym)
- (let ((func (top-level-value sym)))
+(def (untrace symbol)
+ (let ((func (top-level-value symbol)))
(when (traced? func)
- (set-top-level-value! sym
+ (set-top-level-value! symbol
(aref (fn-vals func) 3))))
(void))
@@ -894,10 +894,10 @@
[tail (or (and name-cons
(cdr slot))
(list nil))]}
- (when (or (not (symbol? name))
+ (when (or (not (sym? name))
(keyword? name))
(error "invalid slot name: " name))
- (list* (symbol (str ":" name))
+ (list* (sym (str ":" name))
(if (keyword? (car tail))
(cons nil tail)
tail))))
@@ -916,16 +916,16 @@
; and keywords for names
[slots-kw (tokw slots)]
; struct's underlying type's predicate (either vec? or list?)
- [type? (symbol (str type "?"))]
+ [type? (sym (str type "?"))]
; struct's predicate name
[is? (or predicate
- (symbol (str name "?")))]
+ (sym (str name "?")))]
; constructor name and arguments
[constructor
(and constructor ; NIL means none to make at all
(or (and (atom? constructor) ; a single argument
(cons (or (and (eq? constructor T) ; T means the defaults
- (symbol (str "make-" name)))
+ (sym (str "make-" name)))
constructor) ; else a custom name
slots-kw))
constructor))] ; anything else means custom name and args
@@ -942,7 +942,7 @@
[= (length s) ,(+ (length named) num-slots)]))
; documentation string
(when ,doc
- (symbol-set-doc ',name ,doc))
+ (sym-set-doc ',name ,doc))
; constructor
,(when constructor `(def ,constructor
(,type ',@named ,@slots-car)))
@@ -949,7 +949,7 @@
; accessor per slot
,@(map-int (λ (i) [let* {[opts (slot-opts (list-ref slots-kw i))]
[fld (list-ref slots-car i)]
- [fun (symbol (str access fld))]}
+ [fun (sym (str access fld))]}
`(def (,fun s (v #.(void)))
(assert (,is? s))
(if (void? v)
@@ -967,8 +967,9 @@
;;; toplevel
-(def (macrocall? e) (and (symbol? (car e))
- (symbol-syntax (car e))))
+(def (macrocall? e)
+ (and (sym? (car e))
+ (get-syntax (car e))))
(def (macroexpand-1 e)
(if (atom? e)
@@ -1058,7 +1059,7 @@
(doc (value-get-doc (cddr e))))
(when doc
(set! e (cdr e))
- (symbol-set-doc name doc))
+ (sym-set-doc name doc))
`(def ,name ,(expand-in (caddr e) env))))
(let* ((formals (cdadr e))
(name (caadr e))
@@ -1068,7 +1069,7 @@
(menv (nconc (map list vars) env)))
(when doc
(set! body (cdr body))
- (symbol-set-doc name doc formals))
+ (sym-set-doc name doc formals))
`(def ,(cons name (expand-lambda-list formals menv))
,.(expand-body body menv)))))
@@ -1109,7 +1110,7 @@
((macrocall? e) => (λ (f)
(expand-in (apply f (cdr e)) env)))
((or bnd ; bound lexical or toplevel var
- (not (symbol? head))
+ (not (sym? head))
(bound? head))
(default))
((eq? head 'quote) e)
@@ -1234,7 +1235,7 @@
(print (car e))
(princ ": ")
(let ((msg (cadr e)))
- ((if (or (str? msg) (symbol? msg))
+ ((if (or (str? msg) (sym? msg))
princ
print)
msg)))
--- a/src/table.c
+++ b/src/table.c
@@ -198,5 +198,5 @@
void
table_init(void)
{
- sl_tabletype = define_opaque_type(symbol("table", false), sizeof(sl_htable), &table_vtable, nil);
+ sl_tabletype = define_opaque_type(mk_sym("table", false), sizeof(sl_htable), &table_vtable, nil);
}
--- a/src/types.c
+++ b/src/types.c
@@ -7,7 +7,7 @@
get_type(sl_v t)
{
sl_type *ft;
- if(issymbol(t)){
+ if(issym(t)){
ft = ((sl_sym*)ptr(t))->type;
if(ft != nil)
return ft;
@@ -31,7 +31,7 @@
assert(ft != nil);
ft->type = t;
ft->numtype = NONNUMERIC;
- if(issymbol(t)){
+ if(issym(t)){
ft->numtype = sym_to_numtype(t);
assert(valid_numtype(ft->numtype));
((sl_sym*)ptr(t))->type = ft;
--- a/src/vm.h
+++ b/src/vm.h
@@ -154,7 +154,7 @@
v = vec_elt(v, GET_S32(ip));
ip += 4;
}
- assert(issymbol(v));
+ assert(issym(v));
sl_sym *sym = ptr(v);
if(sl_unlikely(sym->binding == UNBOUND)){
*ipd = (uintptr)ip;
@@ -593,8 +593,8 @@
NEXT_OP;
}
-OP(OP_SYMBOLP)
- sp[-1] = issymbol(sp[-1]) ? sl_t : sl_nil;
+OP(OP_SYMP)
+ sp[-1] = issym(sp[-1]) ? sl_t : sl_nil;
NEXT_OP;
OP(OP_NUMP)
@@ -657,7 +657,7 @@
OP(OP_BOUNDP) {
*ipd = (uintptr)ip;
- sl_sym *sym = tosymbol(sp[-1]);
+ sl_sym *sym = tosym(sp[-1]);
sp[-1] = sym->binding == UNBOUND ? sl_nil : sl_t;
NEXT_OP;
}
@@ -846,7 +846,7 @@
sl_v v = fn_vals(bp[-1]);
assert(i < (int)vec_size(v));
v = vec_elt(v, i);
- assert(issymbol(v));
+ assert(issym(v));
sl_sym *sym = ptr(v);
v = sp[-1];
if(!isconstant(sym))
--- a/test/ast/asttools.lsp
+++ b/test/ast/asttools.lsp
@@ -1,7 +1,7 @@
; utilities for AST processing
(def (symconcat s1 s2)
- (symbol (str s1 s2)))
+ (sym (str s1 s2)))
(def (list-adjoin item lst)
(if (member item lst)
@@ -105,7 +105,7 @@
(if i (list 'lexref lev i v)
(lookup-var v (cdr env) (+ lev 1))))))
(def (lvc- e env)
- (cond ((symbol? e) (lookup-var e env 0))
+ (cond ((sym? e) (lookup-var e env 0))
((cons? e)
(if (eq? (car e) 'quote)
e
@@ -137,7 +137,7 @@
()
; mapper: replace symbol if unbound
(lambda (te env)
- (if (symbol? te)
+ (if (sym? te)
(let ((found (assq te transl)))
(if (and found
(not (memq te env)))
--- a/test/ast/match.lsp
+++ b/test/ast/match.lsp
@@ -38,7 +38,7 @@
; This is NP-complete. Be careful.
;
(def (match- p expr state)
- (cond ((symbol? p)
+ (cond ((sym? p)
(cond ((eq? p '_) state)
(else
(let ((capt (assq p state)))
@@ -133,7 +133,7 @@
; given a pattern p, return the list of capturing variables it uses
(def (patargs- p)
- (cond ((and (symbol? p)
+ (cond ((and (sym? p)
(not (member p metasymbols)))
(list p))
--- a/test/ast/rpasses.lsp
+++ b/test/ast/rpasses.lsp
@@ -8,7 +8,7 @@
(def (assigned-var e)
(and (cons? e)
(or (eq? (car e) '<-) (eq? (car e) 'ref=))
- (symbol? (cadr e))
+ (sym? (cadr e))
(cadr e)))
(def (func-argnames f)
@@ -20,7 +20,7 @@
(let ((ctr 0))
(set! r-gensym (lambda ()
- (prog1 (symbol (str "%r:" ctr))
+ (prog1 (sym (str "%r:" ctr))
(set! ctr (+ ctr 1))))))
(def (dollarsign-transform e)
@@ -27,8 +27,8 @@
(pattern-expand
(pattern-lambda ($ lhs name)
(let* ((g (if (not (cons? lhs)) lhs (r-gensym)))
- (n (if (symbol? name)
- name ;(symbol->str name)
+ (n (if (sym? name)
+ name ;(str name)
name))
(expr `(r-call
r-aref ,g (index-in-strlist ,n (r-call attr ,g "names")))))
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -462,7 +462,7 @@
(table eq? 2 eqv? 2
equal? 2 atom? 1
not 1 nan? 1
- cons? 1 symbol? 1
+ cons? 1 sym? 1
num? 1 bound? 1
cons? 1 builtin? 1
vec? 1 fixnum? 1
@@ -646,8 +646,8 @@
(assert-fail (= (length (u64 0)) 4))
(assert-fail (= (length (bignum 0)) 0))
-(assert-fail (symbol 1))
-(assert-fail (symbol 'blah))
+(assert-fail (sym 1))
+(assert-fail (sym 'blah))
(assert-fail (exit 1 2))
(assert (int-valued? 1.0))
--- a/tools/gen.lsp
+++ b/tools/gen.lsp
@@ -38,7 +38,7 @@
OP_KEYARGS keyargs nil nil nil
OP_CONS cons 2 (λ (x y) (cons x y)) nil
OP_EQ eq? 2 (λ (x y) (eq? x y)) nil
- OP_SYMBOLP symbol? 1 (λ (x) (symbol? x)) nil
+ OP_SYMP sym? 1 (λ (x) (sym? x)) nil
OP_NOT not 1 (λ (x) (not x)) nil
OP_CADR cadr 1 (λ (x) (cadr x)) nil
OP_NEG neg nil nil nil