ref: 34f94d8f686d27d00fcca2c4bc596d339fd3f5b0
parent: cf3f244661f70421b8c266b3670a8481835d604e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Oct 27 15:56:57 EDT 2024
rename from [a-z]+.[a-z]+ to [a-z]+-[a-z]+ for consistency; do a few renames to be more in line with other implementations
--- a/aliases.scm
+++ b/aliases.scm
@@ -23,12 +23,11 @@
(define vector-ref aref)
(define vector-set! aset!)
(define vector-length length)
-(define make-vector vector.alloc)
+(define make-vector vector-alloc)
(define (vector-fill! v f)
(for 0 (- (length v) 1)
(lambda (i) (aset! v i f)))
#t)
-(define (vector-map f v) (vector.map f v))
(define array-ref aref)
(define (array-set! a obj i0 . idxs)
@@ -63,9 +62,6 @@
(define (char->integer c) (fixnum c))
(define (integer->char i) (rune i))
-(define char-upcase char.upcase)
-(define char-downcase char.downcase)
-(define char-titlecase char.titlecase)
(define char=? eqv?)
(define char<? <)
(define char>? >)
@@ -79,49 +75,48 @@
(define string>=? >=)
(define string-copy copy)
(define string-append string)
-(define string-length string.count)
(define string->symbol symbol)
(define (symbol->string s) (string s))
(define symbol=? eq?)
(define (make-string k (fill #\space))
- (string.rep fill k))
+ (string-rep fill k))
-(define string-ref string.char)
+(define string-ref string-char)
(define (list->string l) (apply string l))
(define (string->list s)
- (do ((i (string.count s) i)
- (l '() (cons (string.char s i) l)))
+ (do ((i (string-length s) i)
+ (l '() (cons (string-char s i) l)))
((= i 0) l)
(set! i (1- i))))
-(define substring string.sub)
+(define substring string-sub)
(define (input-port? x) (iostream? x))
(define (output-port? x) (iostream? x))
(define (port? x) (iostream? x))
-(define close-input-port io.close)
-(define close-output-port io.close)
-(define (read-char (s *input-stream*)) (io.getc s))
-(define (peek-char (s *input-stream*)) (io.peekc s))
-(define (write-char c (s *output-stream*)) (io.putc s c))
+(define close-input-port io-close)
+(define close-output-port io-close)
+(define (read-char (s *input-stream*)) (io-getc s))
+(define (peek-char (s *input-stream*)) (io-peekc s))
+(define (write-char c (s *output-stream*)) (io-putc s c))
; TODO: unread-char
-(define (port-eof? p) (io.eof? p))
+(define (port-eof? p) (io-eof? p))
(define (open-input-string str)
(let ((b (buffer)))
- (io.write b str)
- (io.seek b 0)
+ (io-write b str)
+ (io-seek b 0)
b))
(define (open-output-string) (buffer))
(define (open-string-output-port)
(let ((b (buffer)))
- (values b (lambda () (io.tostring! b)))))
+ (values b (lambda () (io-tostring! b)))))
(define (get-output-string b)
- (let ((p (io.pos b)))
- (io.seek b 0)
- (let ((s (io.readall b)))
- (io.seek b p)
+ (let ((p (io-pos b)))
+ (io-seek b 0)
+ (let ((s (io-readall b)))
+ (io-seek b p)
(if (eof-object? s) "" s))))
(define (open-input-file name) (file name :read))
@@ -141,42 +136,42 @@
(with-bindings ((*print-readably* #t))
(write x port)))
-(define (put-u8 port o) (io.write port (uint8 o)))
+(define (put-u8 port o) (io-write port (uint8 o)))
(define (put-string port s (start 0) (count #f))
(let* ((end (if count
(+ start count)
- (string.count s))))
- (io.write port (string.sub s start (- end start)))))
+ (string-length s))))
+ (io-write port (string-sub s start (- end start)))))
-(define (io.skipws s)
- (let ((c (io.peekc s)))
+(define (io-skipws s)
+ (let ((c (io-peekc s)))
(if (and (not (eof-object? c)) (char-whitespace? c))
- (begin (io.getc s)
- (io.skipws s)))))
+ (begin (io-getc s)
+ (io-skipws s)))))
(define (with-output-to-file name thunk)
(let ((f (file name :write :create :truncate)))
(unwind-protect
(with-output-to f (thunk))
- (io.close f))))
+ (io-close f))))
(define (with-input-from-file name thunk)
(let ((f (file name :read)))
(unwind-protect
(with-input-from f (thunk))
- (io.close f))))
+ (io-close f))))
(define (call-with-input-file name proc)
(let ((f (open-input-file name)))
(prog1 (proc f)
- (io.close f))))
+ (io-close f))))
(define (call-with-output-file name proc)
(let ((f (open-output-file name)))
(prog1 (proc f)
- (io.close f))))
+ (io-close f))))
-(define (file-exists? f) (path.exists? f))
+(define (file-exists? f) (path-exists? f))
(define (delete-file name) (void)) ; TODO
(define (display x (port *output-stream*))
@@ -275,9 +270,9 @@
(define table-ref get)
(define table-set! put!)
(define (read-line (s *input-stream*))
- (io.flush *output-stream*)
- (io.discardbuffer s)
- (io.readline s))
+ (io-flush *output-stream*)
+ (io-discardbuffer s)
+ (io-readline s))
(define (shell-command s) 1)
(define (error-exception-message e) (cadr e))
(define (error-exception-parameters e) (cddr e))
@@ -285,7 +280,7 @@
(define (with-output-to-string nada thunk)
(let ((b (buffer)))
(with-output-to b (thunk))
- (io.tostring! b)))
+ (io-tostring! b)))
-(define (read-u8) (io.read *input-stream* 'uint8))
+(define (read-u8) (io-read *input-stream* 'uint8))
(define modulo mod)
--- a/builtins.c
+++ b/builtins.c
@@ -274,7 +274,7 @@
type_error("number", args[0]);
}
-BUILTIN("vector.alloc", vector_alloc)
+BUILTIN("vector-alloc", vector_alloc)
{
int i, k;
value_t f, v;
@@ -290,7 +290,7 @@
return v;
}
-BUILTIN("time.now", time_now)
+BUILTIN("time-now", time_now)
{
argcount(nargs, 0);
USED(args);
@@ -310,7 +310,7 @@
type_error("number", a);
}
-BUILTIN("time.string", time_string)
+BUILTIN("time->string", time_string)
{
argcount(nargs, 1);
double t = todouble(args[0]);
@@ -319,7 +319,7 @@
return string_from_cstr(buf);
}
-BUILTIN("time.fromstring", time_fromstring)
+BUILTIN("string->time", string_time)
{
argcount(nargs, 1);
char *ptr = tostring(args[0]);
@@ -330,7 +330,7 @@
return mk_double(t);
}
-BUILTIN("path.cwd", path_cwd)
+BUILTIN("path-cwd", path_cwd)
{
if(nargs > 1)
argcount(nargs, 1);
@@ -345,7 +345,7 @@
return FL_T;
}
-BUILTIN("path.exists?", path_existsp)
+BUILTIN("path-exists?", path_existsp)
{
argcount(nargs, 1);
char *path = tostring(args[0]);
@@ -352,7 +352,7 @@
return access(path, F_OK) == 0 ? FL_T : FL_F;
}
-BUILTIN("os.getenv", os_getenv)
+BUILTIN("os-getenv", os_getenv)
{
argcount(nargs, 1);
char *name = tostring(args[0]);
@@ -364,7 +364,7 @@
return cvalue_static_cstring(val);
}
-BUILTIN("os.setenv", os_setenv)
+BUILTIN("os-setenv", os_setenv)
{
argcount(nargs, 2);
char *name = tostring(args[0]);
@@ -393,25 +393,25 @@
return fixnum(r);
}
-BUILTIN("rand.uint32", rand_uint32)
+BUILTIN("rand-uint32", rand_uint32)
{
USED(args); USED(nargs);
return mk_uint32(genrand_uint32());
}
-BUILTIN("rand.uint64", rand_uint64)
+BUILTIN("rand-uint64", rand_uint64)
{
USED(args); USED(nargs);
return mk_uint64(genrand_uint64());
}
-BUILTIN("rand.double", rand_double)
+BUILTIN("rand-double", rand_double)
{
USED(args); USED(nargs);
return mk_double(genrand_double());
}
-BUILTIN("rand.float", rand_float)
+BUILTIN("rand-float", rand_float)
{
USED(args); USED(nargs);
return mk_float(genrand_double());
--- a/compiler.lsp
+++ b/compiler.lsp
@@ -91,7 +91,7 @@
(bcode (buffer))
(vi #f)
(nxt #f))
- (io.write bcode #int32(0))
+ (io-write bcode #int32(0))
(while (< i n)
(begin
(set! vi (aref v i))
@@ -99,7 +99,7 @@
(begin (put! label-to-loc (aref v (+ i 1)) (sizeof bcode))
(set! i (+ i 2)))
(begin
- (io.write bcode
+ (io-write bcode
(byte
(get Instructions
(if long?
@@ -116,51 +116,51 @@
(set! nxt (if (< i n) (aref v i) #f))
(cond ((memq vi '(jmp brf brt brne brnn brn))
(put! fixup-to-label (sizeof bcode) nxt)
- (io.write bcode ((if long? int32 int16) 0))
+ (io-write bcode ((if long? int32 int16) 0))
(set! i (+ i 1)))
((eq? vi 'brbound)
- (io.write bcode (int32 nxt))
+ (io-write bcode (int32 nxt))
(set! i (+ i 1)))
((number? nxt)
(case vi
((loadv.l loadg.l setg.l loada.l seta.l
largc lvargc call.l tcall.l)
- (io.write bcode (int32 nxt))
+ (io-write bcode (int32 nxt))
(set! i (+ i 1)))
((loadc setc) ; 2 uint8 args
- (io.write bcode (uint8 nxt))
+ (io-write bcode (uint8 nxt))
(set! i (+ i 1))
- (io.write bcode (uint8 (aref v i)))
+ (io-write bcode (uint8 (aref v i)))
(set! i (+ i 1)))
((loadc.l setc.l optargs keyargs) ; 2 int32 args
- (io.write bcode (int32 nxt))
+ (io-write bcode (int32 nxt))
(set! i (+ i 1))
- (io.write bcode (int32 (aref v i)))
+ (io-write bcode (int32 (aref v i)))
(set! i (+ i 1))
(if (eq? vi 'keyargs)
- (begin (io.write bcode (int32 (aref v i)))
+ (begin (io-write bcode (int32 (aref v i)))
(set! i (+ i 1)))))
(else
; other number arguments are always uint8
- (io.write bcode (uint8 nxt))
+ (io-write bcode (uint8 nxt))
(set! i (+ i 1)))))
(else #f))))))
- (table.foreach
+ (table-foreach
(λ (addr labl)
- (begin (io.seek bcode addr)
- (io.write bcode ((if long? int32 int16)
+ (begin (io-seek bcode addr)
+ (io-write bcode ((if long? int32 int16)
(- (get label-to-loc labl)
addr)))))
fixup-to-label)
- (io.tostring! bcode))))
+ (io-tostring! bcode))))
(define (const-to-idx-vec e)
- (let ((cvec (vector.alloc (bcode:nconst e))))
- (table.foreach (λ (val idx) (aset! cvec idx val))
+ (let ((cvec (vector-alloc (bcode:nconst e))))
+ (table-foreach (λ (val idx) (aset! cvec idx val))
(bcode:ctable e))
cvec))
@@ -462,7 +462,7 @@
(define (keyword->symbol k)
(if (keyword? k)
(symbol (let ((s (string k)))
- (string.sub s 0 (1- (string.count s)))))
+ (string-sub s 0 (1- (string-length s)))))
k))
(define (lambda-arg-names argl)
@@ -599,7 +599,7 @@
(ash (aref a (+ i 1)) 8))))
(define (hex5 n)
- (string.lpad (number->string n 16) 5 #\0))
+ (string-lpad (number->string n 16) 5 #\0))
(define (disassemble f . lev?)
(if (null? lev?)
@@ -620,7 +620,7 @@
(N (length code)))
(while (< i N)
; find key whose value matches the current byte
- (let ((inst (table.foldl (λ (k v z)
+ (let ((inst (table-foldl (λ (k v z)
(or z (and (eq? v (aref code i))
k)))
#f Instructions)))
@@ -692,7 +692,7 @@
(define (make-perfect-hash-table alist)
(define ($hash-keyword key n) (mod0 (abs (hash key)) n))
(let loop1 ((n (length alist)))
- (let ((v (vector.alloc (* 2 n) #f)))
+ (let ((v (vector-alloc (* 2 n) #f)))
(let loop2 ((lst alist))
(if (pair? lst)
(let ((key (caar lst)))
--- a/examples/rule30.lsp
+++ b/examples/rule30.lsp
@@ -12,7 +12,7 @@
(logand ~L ~b R)))))
(define (bin-draw s)
- (string.map (lambda (c) (case c
+ (string-map (lambda (c) (case c
(#\1 #\#)
(#\0 #\ )
(else c)))
@@ -20,6 +20,6 @@
(for-each (lambda (n)
(begin
- (princ (bin-draw (string.lpad (number->string n 2) 63 #\0)))
+ (princ (bin-draw (string-lpad (number->string n 2) 63 #\0)))
(newline)))
(nestlist rule30-step (uint64 0x0000000080000000) 32))
--- a/flisp.boot
+++ b/flisp.boot
@@ -44,7 +44,7 @@
if begin cddr caddr)) caadr #fn("<000n1200A<e2e121072A510e2920910=51e4e3:" #(let
if caddr)) #fn(gensym) if))) cond-clauses->if))))) throw #fn(":000n220212223e201e4e2:" #(raise
list quote thrown-value)) time #fn("7000n120>215061:" #(#fn(">000n120021e1e2e122A23242521e10e326e4e3e3:" #(let
- time.now prog1 princ "Elapsed time: " - " seconds\n"))
+ time-now prog1 princ "Elapsed time: " - " seconds\n"))
#fn(gensym))) with-output-to #fn("=000|12021e1220e2e1e12315163:" #(#fn(nconc)
with-bindings *output-stream* #fn(copy-list))) with-bindings #fn(">000|120>21220522123052212405263:" #(#fn("B000n32021e1222382053e1242225015351262027e124F51522027e1242228082535152e3e164:" #(#fn(nconc)
let #fn(map) #.list #fn(copy-list) #fn("8000n22001e3:" #(set!))
@@ -56,7 +56,7 @@
length=) 1arg-lambda?)
<= #fn("7000n210L;IB0470051;380470151S:" #(nan?) <=) >
#fn("7000n210L:" #() >) >= #fn("7000n201L;IB0470051;380470151S:" #(nan?) >=)
- Instructions #table(brne 19 vargc 76 load1 27 = 60 setc.l 75 sub2 80 brne.l 85 largc 81 brnn 26 loadc.l 70 loadi8 66 < 28 nop 46 set-cdr! 30 loada 8 neg 37 bound? 42 / 58 brn.l 88 lvargc 82 brt 25 trycatch 77 null? 38 load0 21 jmp.l 48 loadv 2 seta 15 keyargs 91 * 57 function? 44 builtin? 43 aref 23 optargs 89 loadt 20 vector? 45 cdr 13 brf 3 loadc00 17 symbol? 34 cadr 36 pop 4 pair? 18 for 78 closure 14 loadf 31 compare 61 loadv.l 67 setg.l 72 brn 87 eqv? 51 aset! 64 atom? 24 eq? 33 boolean? 39 brt.l 50 tapply 79 dummy_nil 94 loada0 0 brbound 90 dup 11 loadc01 22 list 53 loadc 9 apply 54 dummy_t 93 setg 71 loada1 1 tcall.l 84 jmp 16 fixnum? 41 cons 32 loadg.l 68 tcall 6 dummy_eof 95 call 5 - 56 brf.l 49 + 55 dummy_f 92 add2 29 seta.l 73 loadnil 65 brnn.l 86 setc 74 set-car! 47 loadg 7 vector 63 loada.l 69 argc 62 div0 59 ret 10 car 12 number? 40 equal? 52 call.l 83 not 35)
+ Instructions #table(not 35 vargc 76 load1 27 = 60 setc.l 75 sub2 80 brne.l 85 largc 81 brnn 26 loadc.l 70 loadi8 66 < 28 nop 46 set-cdr! 30 loada 8 neg 37 bound? 42 / 58 brn.l 88 lvargc 82 brt 25 trycatch 77 null? 38 load0 21 jmp.l 48 loadv 2 seta 15 keyargs 91 * 57 function? 44 builtin? 43 aref 23 optargs 89 loadt 20 vector? 45 cdr 13 brf 3 loadc00 17 symbol? 34 cadr 36 pop 4 pair? 18 for 78 closure 14 loadf 31 compare 61 loadv.l 67 setg.l 72 brn 87 eqv? 51 aset! 64 atom? 24 eq? 33 boolean? 39 brt.l 50 tapply 79 dummy_nil 94 loada0 0 brbound 90 dup 11 loadc01 22 list 53 loadc 9 apply 54 dummy_t 93 setg 71 loada1 1 tcall.l 84 jmp 16 fixnum? 41 cons 32 loadg.l 68 tcall 6 dummy_eof 95 call 5 - 56 brf.l 49 + 55 dummy_f 92 add2 29 seta.l 73 loadnil 65 brnn.l 86 setc 74 set-car! 47 loadg 7 vector 63 loada.l 69 argc 62 div0 59 ret 10 car 12 number? 40 equal? 52 call.l 83 brne 19)
__init_globals #fn("6000n020w1422w3474w5476w7478w9:" #("/"
*directory-separator*
"\n"
@@ -67,10 +67,10 @@
*input-stream*
*stderr*
*error-stream*) __init_globals)
- __rcscript #fn("8000n02021725161:" #(#fn("7000n12005138071061:D:" #(#fn(path.exists?)
+ __rcscript #fn("8000n02021725161:" #(#fn("7000n12005138071061:D:" #(#fn(path-exists?)
load)) #fn("8000n1020c35021:022c3?0232425512662:232427512862:" #(unknown ""
plan9 #fn(string)
- #fn(os.getenv)
+ #fn(os-getenv)
"home" "/lib/flisprc"
"HOME" "/.flisprc"))
*os-name*) __rcscript)
@@ -187,8 +187,8 @@
lambda) #0#)
compile-while #fn("9000n420>710517105162:" #(#fn(":000n270AFO715054472A052470AFO90254473A24153473A2552470AFO90354473A26053472A162:" #(compile-in
void mark-label emit brf pop jmp)) make-label) compile-while)
- const-to-idx-vec #fn("9000n120>21720515161:" #(#fn("9000n17021>72A515240:" #(table.foreach
- #fn("8000n2A10p:" #()) bcode:ctable)) #fn(vector.alloc) bcode:nconst) const-to-idx-vec)
+ const-to-idx-vec #fn("9000n120>21720515161:" #(#fn("9000n17021>72A515240:" #(table-foreach
+ #fn("8000n2A10p:" #()) bcode:ctable)) #fn(vector-alloc) bcode:nconst) const-to-idx-vec)
copy-tree #fn("8000n10H3400:700<51700=51P:" #(copy-tree) copy-tree)
count #fn("7000n220>D61:" #(#fn("9000n120>?040AFE63:" #(#fn(":000n31J5082:A01=01<5139082KM@408263:" #() count-)))) count)
delete-duplicates #fn("8000n1700rD523<021>225061:0H3400:230<0=62:" #(length>
@@ -207,7 +207,7 @@
setc) " " (loadc.l setc.l optargs keyargs) keyargs brbound (jmp brf brt brne
brnn brn) "@"
hex5 ref-int16-LE (jmp.l brf.l brt.l brne.l brnn.l brn.l)))))
- #fn(table.foldl) #fn("8000n382;I@041921AGQ;34040:" #()) Instructions))
+ #fn(table-foldl) #fn("8000n382;I@041921AGQ;34040:" #()) Instructions))
#fn(length))))) #fn(function:code) #fn(function:vals)) disassemble)
div #fn("8000n201k0EL;3C041EL;3404K;I504r/;I404EM:" #() div) emit
#fn("G000|282Jb0120Q;3C040EGB;3:040EG<21Q3;00EG22_@:00E10EGPp@\xe2023124523A075082<52e1?2@30D426>271285251429>2712:5251412;C\\0822<d3=02=?14q?2@F0822>d3=02??14q?2@30O@30D412@C\\0822Ad3=02B?14q?2@F0822Cd3=02D?14q?2@30O@30D42E>0EGB3900EG<@30q0EG5240:" #(car
@@ -221,14 +221,14 @@
emit-optional-arg-inits #fn("8000n582B3=020>7105161:D:" #(#fn("<000n170A2190453470A22053473A7490390452FPO759025154470A2690453470A2752478A052479AF902=903904KM65:" #(emit
brbound brt compile-in list-head cadar seta pop mark-label
emit-optional-arg-inits)) make-label) emit-optional-arg-inits)
- encode-byte-code #fn("8000n1207105161:" #(#fn("8000n1207105161:" #(#fn(";000n120>7122051r322051r2ki2M235261:" #(#fn("=000n120>21A51E225022502350OO67:" #(#fn("?000n7208421524D10L3\xff049101G?548522CO023829101KMG2484515341r2M?1@\xcf02084752677A3<028>8551@408552515241KM?1410L3:09101G@30O?6429852:523^02383248451865342084A3707;@407<E515241KM?1@_0852=CG020847;86515241KM?1@C086X3<02>>8551@30O@_/47?2@>835242A8461:" #(#fn(io.write)
+ encode-byte-code #fn("8000n1207105161:" #(#fn("8000n1207105161:" #(#fn(";000n120>7122051r322051r2ki2M235261:" #(#fn("=000n120>21A51E225022502350OO67:" #(#fn("?000n7208421524D10L3\xff049101G?548522CO023829101KMG2484515341r2M?1@\xcf02084752677A3<028>8551@408552515241KM?1410L3:09101G@30O?6429852:523^02383248451865342084A3707;@407<E515241KM?1@_0852=CG020847;86515241KM?1@C086X3<02>>8551@30O@_/47?2@>835242A8461:" #(#fn(io-write)
#int32(0) label #fn(put!) #fn(sizeof) byte #fn(get) Instructions #fn("7000n1020C5021:022C5023:024C5025:026C5027:028C5029:02:C502;:905:" #(jmp
jmp.l brt brt.l brf brf.l brne brne.l brnn brnn.l brn brn.l))
#fn(memq) (jmp brf brt brne brnn brn) int32 int16 brbound #fn(":000n120021523H0229047390651524FKMz01:20024523`0229047590651524FKMz0142290475920FG51524FKMz01:20026523\x820229047390651524FKMz0142290473920FG51524FKMz01490527CJ02290473920FG51524FKMz01:D:229047590651524FKMz01:" #(#fn(memq)
(loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l)
- #fn(io.write) int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs)
- keyargs)) table.foreach #fn("<000n22090405242190491037072@4073249021520\x805162:" #(#fn(io.seek)
- #fn(io.write) int32 int16 #fn(get))) #fn(io.tostring!)))
+ #fn(io-write) int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs)
+ keyargs)) table-foreach #fn("<000n22090405242190491037072@4073249021520\x805162:" #(#fn(io-seek)
+ #fn(io-write) int32 int16 #fn(get))) #fn(io-tostring!)))
#fn(length) #fn(table) #fn(buffer))) >= #fn(length) 65536)) list->vector))
reverse!) encode-byte-code)
error #fn(":000|020210P61:" #(#fn(raise) error) error) eval
@@ -270,22 +270,22 @@
#.car #.cdr) for-each-n)))) for-each)
get-defined-vars #fn("8000n170A05161:" #(delete-duplicates) #1=#(#fn("9000n10H340q:0<20Q;36040=B3d00TR;37040Te1;IS040TB;3E0471051R;3:0471051e1;I404q:0<22C>02324A0=52\x7f2:q:" #(define
caadr begin #fn(nconc) #fn(map)) #1#) ()))
- hex5 #fn("9000n170210r@52r52263:" #(string.lpad #fn(number->string)
+ hex5 #fn("9000n170210r@52r52263:" #(string-lpad #fn(number->string)
#\0) hex5)
identity #fn("6000n10:" #() identity) in-env?
#fn("8000n21B;3F042001<52;I:047101=62:" #(#fn(memq) in-env?) in-env?)
index-of #fn(":000n31J40O:01<C5082:7001=82KM63:" #(index-of) index-of)
- io.readall #fn("7000n120>215061:" #(#fn("8000n1200A52421>2205161:" #(#fn(io.copy)
- #fn("7000n1020d;3:0421910513702260:0:" #("" #fn(io.eof?)
+ io-readall #fn("7000n120>215061:" #(#fn("8000n1200A52421>2205161:" #(#fn(io-copy)
+ #fn("7000n1020d;3:0421910513702260:0:" #("" #fn(io-eof?)
#fn(eof-object)))
- #fn(io.tostring!))) #fn(buffer)) io.readall)
- io.readline #fn("8000n12002162:" #(#fn(io.readuntil) #\newline) io.readline)
- io.readlines #fn("8000n17071062:" #(read-all-of io.readline) io.readlines)
+ #fn(io-tostring!))) #fn(buffer)) io-readall)
+ io-readline #fn("8000n12002162:" #(#fn(io-readuntil) #\newline) io-readline)
+ io-readlines #fn("8000n17071062:" #(read-all-of io-readline) io-readlines)
iota #fn("8000n17071062:" #(map-int identity) iota) keyword->symbol
#fn("9000n1200513@02122230515161:0:" #(#fn(keyword?)
#fn(symbol)
- #fn(";000n1200E71220515163:" #(#fn(string.sub)
- 1- #fn(string.count))) #fn(string)) keyword->symbol)
+ #fn(";000n1200E71220515163:" #(#fn(string-sub)
+ 1- #fn(string-length))) #fn(string)) keyword->symbol)
keyword-arg? #fn("7000n10B;3904200<61:" #(#fn(keyword?)) keyword-arg?)
lambda-arg-names #fn("9000n170217205162:" #(map! #fn("7000n10B390700<61:0:" #(keyword->symbol))
to-proper) lambda-arg-names)
@@ -303,9 +303,9 @@
list-ref #fn("8000n2700152<:" #(list-tail) list-ref) list-tail
#fn("9000n2701E523400:710=1K\x8062:" #(<= list-tail) list-tail)
list? #fn("7000n10V;I@040B;3904700=61:" #(list?) list?) load
- #fn("9000n120>210225261:" #(#fn("7000n120>21>}:" #(#fn("9000n020>D51DDD63:" #(#fn("6000n120>?040:" #(#fn(":000n32091051IC0A219105107215163:2391051472161:" #(#fn(io.eof?)
- #fn(read) load-process #fn(io.close)))))))
- #fn("9000n120A51421229100e361:" #(#fn(io.close)
+ #fn("9000n120>210225261:" #(#fn("7000n120>21>}:" #(#fn("9000n020>D51DDD63:" #(#fn("6000n120>?040:" #(#fn(":000n32091051IC0A219105107215163:2391051472161:" #(#fn(io-eof?)
+ #fn(read) load-process #fn(io-close)))))))
+ #fn("9000n120A51421229100e361:" #(#fn(io-close)
#fn(raise) load-error)))) #fn(file) :read) load)
load-process #fn("7000n170061:" #(eval) load-process) lookup-sym
#fn("7000n41J5020:21>1<61:" #((global)
@@ -318,14 +318,14 @@
make-label #fn("6000n12060:" #(#fn(gensym)) make-label)
make-perfect-hash-table #fn("7000n120>D61:" #(#fn("8000n120?0421>D5122A5161:" #(#fn("9000n270712205151162:" #(mod0
abs #fn(hash)) $hash-keyword) #fn("6000n120>?040:" #(#fn("9000n120>21r20i2O5261:" #(#fn("7000n120>D5193061:" #(#fn("6000n120>?040:" #(#fn("8000n10B3=020>7105161:910:" #(#fn(":000n120>r2950093052i261:" #(#fn("9000n19300G3=0950940KM61:9300Ap49300KM7091051p4920910=61:" #(cdar))))
- caar)))))) #fn(vector.alloc))))) #fn(length)))) make-perfect-hash-table)
+ caar)))))) #fn(vector-alloc))))) #fn(length)))) make-perfect-hash-table)
make-system-image #fn(";000n120210222324542562:" #(#fn("8000n220>717262:" #(#fn("7000n2Dw04Dw1422>23>61:" #(*print-pretty*
*print-readably* #fn("7000n120>21>}0504:" #(#fn(":000n020>7122>73245051525142592061:" #(#fn("=000n1202122230222405253f2920524259207662:" #(#fn(write)
#fn(nconc) #fn(map) #.list #fn(top-level-value)
- #fn(io.write) *linefeed*)) filter #fn("9000n10Z;3w0420051S;3l0421051[S;IC0422051222105151dS;3K0423092152S;3=04242105151S:" #(#fn(constant?)
+ #fn(io-write) *linefeed*)) filter #fn("9000n10Z;3w0420051S;3l0421051[S;IC0422051222105151dS;3K0423092152S;3=04242105151S:" #(#fn(constant?)
#fn(top-level-value) #fn(string) #fn(memq)
#fn(iostream?))) simple-sort #fn(environment)
- #fn(io.close))) #fn("7000n1A50420061:" #(#fn(raise)))))
+ #fn(io-close))) #fn("7000n1A50420061:" #(#fn(raise)))))
#fn("6000n0Aw04Fw1:" #(*print-pretty* *print-readably*)))) *print-pretty*
*print-readably*)) #fn(file) :write :create :truncate (*linefeed*
*directory-separator*
@@ -349,7 +349,7 @@
negative? #fn("7000n10EL:" #() negative?) nestlist
#fn(";000n37082E52340q:1710015182K\x8053P:" #(<= nestlist) nestlist)
newline #fn("9000\x8900001000\x8a0000I7070?0421072524D:" #(*output-stream*
- #fn(io.write) *linefeed*) newline)
+ #fn(io-write) *linefeed*) newline)
nnn #fn("8000n17021062:" #(count #fn("6000n10VS:" #())) nnn)
nreconc #fn("8000n2701062:" #(reverse!-) nreconc) odd?
#fn("7000n170051S:" #(even?) odd?) positive? #fn("8000n1700E62:" #(>) positive?)
@@ -369,7 +369,7 @@
#fn("9000n170A0G513A0930A0G92191063:D:" #(closure?))))
#fn(function:vals))) #fn(function:name)) find-in-f)
#fn("8000n22021>22}61:" #(#fn(";000n103H0207122237405152255261:26:" #(#fn(symbol)
- string.join #fn(map) #fn(string) reverse! "/" lambda))
+ string-join #fn(map) #fn(string) reverse! "/" lambda))
#fn("8000n07021>F524O:" #(for-each #fn("9000n19100Aq63:" #())))
#fn("7000n10B;3B040<20Q;38040T21Q38072061:23061:" #(thrown-value
ffound caddr #fn(raise)))) fn-name) #fn("8000n37021>062:" #(for-each #fn("9000n1702190222534739110EGF5274051=P51475504902KMz02:" #(princ
@@ -377,23 +377,23 @@
*interactive* filter closure? #fn(map) #fn("7000n10Z;380420061:" #(#fn(top-level-value)))
#fn(environment)))) print-stack-trace)
print-to-string #fn("7000n120>215061:" #(#fn("8000n120A052421061:" #(#fn(write)
- #fn(io.tostring!))) #fn(buffer)) print-to-string)
+ #fn(io-tostring!))) #fn(buffer)) print-to-string)
printable? #fn("7000n120051;I80421051S:" #(#fn(iostream?)
#fn(eof-object?)) printable?)
quote-value #fn("7000n1700513400:210e2:" #(self-evaluating? quote) quote-value)
random #fn("8000n1200513<0712250062:23500i2:" #(#fn(integer?) mod
#fn(rand)
- #fn(rand.double)) random)
+ #fn(rand-double)) random)
read-all #fn("8000n17021062:" #(read-all-of #fn(read)) read-all)
- read-all-of #fn("9000n220>D51q015162:" #(#fn("6000n120>?040:" #(#fn("9000n2209115138071061:A10P9109115162:" #(#fn(io.eof?)
+ read-all-of #fn("9000n220>D51q015162:" #(#fn("6000n120>?040:" #(#fn("9000n2209115138071061:A10P9109115162:" #(#fn(io-eof?)
reverse!))))) read-all-of)
ref-int16-LE #fn(";000n2702101EMGE522101KMGr852M61:" #(int16 #fn(ash)) ref-int16-LE)
ref-int32-LE #fn("=000n2702101EMGE522101KMGr8522101r2MGr@522101r3MGrH52g461:" #(int32
#fn(ash)) ref-int32-LE)
repl #fn("8000n020DD62:" #(#fn("6000n220?0421>?1415047260:" #(#fn("8000n070215142273514242526}61:" #(princ
- "> " #fn(io.flush) *output-stream* #fn("8000n1207151S;3<04227305161:" #(#fn(io.eof?)
+ "> " #fn(io-flush) *output-stream* #fn("8000n1207151S;3<04227305161:" #(#fn(io-eof?)
*input-stream* #fn("7000n17005140w14D:" #(print that)) load-process))
- #fn("6000n02060:" #(#fn(read))) #fn("7000n1207151422061:" #(#fn(io.discardbuffer)
+ #fn("6000n02060:" #(#fn(read))) #fn("7000n1207151422061:" #(#fn(io-discardbuffer)
*input-stream* #fn(raise)))) prompt)
#fn("7000n020>21}3;072504F60:O:" #(#fn("7000n0A50;37047060:" #(newline))
#fn("7000n1700514D:" #(top-level-exception-handler))
@@ -412,39 +412,39 @@
#fn(":000n22071051Ae17115163:" #(#fn(nconc) simple-sort))))) simple-sort)
splice-form? #fn("8000n10B;3X040<20Q;IN040<21Q;ID040<22Q;3:04730r252;I704022Q:" #(unquote-splicing
unquote-nsplicing unquote length>) splice-form?)
- string.join #fn("7000n20J5020:21>225061:" #("" #fn("8000n1200A<5247122>A=52423061:" #(#fn(io.write)
- for-each #fn("8000n120A91152420A062:" #(#fn(io.write)))
- #fn(io.tostring!))) #fn(buffer)) string.join)
- string.lpad #fn(";000n3207182122051\x8052062:" #(#fn(string)
- string.rep #fn(string.count)) string.lpad)
- string.map #fn("9000n220>21502215162:" #(#fn("7000n220>E51421061:" #(#fn(";000n1D0FL3P0420A910219110525152472051?0@\x0e/:" #(#fn(io.putc)
- #fn(string.char) 1+)) #fn(io.tostring!)))
+ string-join #fn("7000n20J5020:21>225061:" #("" #fn("8000n1200A<5247122>A=52423061:" #(#fn(io-write)
+ for-each #fn("8000n120A91152420A062:" #(#fn(io-write)))
+ #fn(io-tostring!))) #fn(buffer)) string-join)
+ string-lpad #fn(";000n3207182122051\x8052062:" #(#fn(string)
+ string-rep #fn(string-length)) string-lpad)
+ string-map #fn("9000n220>21502215162:" #(#fn("7000n220>E51421061:" #(#fn(";000n1D0FL3P0420A910219110525152472051?0@\x0e/:" #(#fn(io-putc)
+ #fn(string-char) 1+)) #fn(io-tostring!)))
#fn(buffer)
- #fn(string.count)) string.map)
- string.rep #fn(";000n21r4L3`0701E5235021:1Kl38022061:1r2l390220062:2200063:731513@02207401K\x805262:742200521r2j262:" #(<=
- "" #fn(string) odd? string.rep) string.rep)
- string.rpad #fn("<000n32007182122051\x805262:" #(#fn(string)
- string.rep #fn(string.count)) string.rpad)
- string.tail #fn("8000n2200162:" #(#fn(string.sub)) string.tail)
- string.trim #fn("8000n320>DD62:" #(#fn("8000n220>?0421>?1422>23A5161:" #(#fn(":000n48283L;3?042012108252523@0A017282518364:82:" #(#fn(string.find)
- #fn(string.char) 1+) trim-start) #fn(":000n37082E52;3?042112208252523>0F0173825163:82:" #(>
- #fn(string.find) #fn(string.char) 1-) trim-end)
- #fn("<000n120910A910911E054F91091205363:" #(#fn(string.sub)))
- #fn(string.count)))) string.trim)
+ #fn(string-length)) string-map)
+ string-rep #fn(";000n21r4L3`0701E5235021:1Kl38022061:1r2l390220062:2200063:731513@02207401K\x805262:742200521r2j262:" #(<=
+ "" #fn(string) odd? string-rep) string-rep)
+ string-rpad #fn("<000n32007182122051\x805262:" #(#fn(string)
+ string-rep #fn(string-length)) string-rpad)
+ string-tail #fn("8000n2200162:" #(#fn(string-sub)) string-tail)
+ string-trim #fn("8000n320>DD62:" #(#fn("8000n220>?0421>?1422>23A5161:" #(#fn(":000n48283L;3?042012108252523@0A017282518364:82:" #(#fn(string-find)
+ #fn(string-char) 1+) trim-start) #fn(":000n37082E52;3?042112208252523>0F0173825163:82:" #(>
+ #fn(string-find) #fn(string-char) 1-) trim-end)
+ #fn("<000n120910A910911E054F91091205363:" #(#fn(string-sub)))
+ #fn(string-length)))) string-trim)
symbol-syntax #fn("9000n120710O63:" #(#fn(get)
*syntax-environment*) symbol-syntax)
- table.clone #fn("7000n120>215061:" #(#fn("9000n12021>qA5340:" #(#fn(table.foldl)
- #fn("9000n320A0163:" #(#fn(put!))))) #fn(table)) table.clone)
- table.foreach #fn("9000n22021>q163:" #(#fn(table.foldl)
- #fn("8000n3A01524D:" #())) table.foreach)
- table.invert #fn("7000n120>215061:" #(#fn("9000n12021>qA5340:" #(#fn(table.foldl)
- #fn("9000n320A1063:" #(#fn(put!))))) #fn(table)) table.invert)
- table.keys #fn("9000n12021q063:" #(#fn(table.foldl)
- #fn("7000n3082P:" #())) table.keys)
- table.pairs #fn("9000n12021q063:" #(#fn(table.foldl)
- #fn("7000n301P82P:" #())) table.pairs)
- table.values #fn("9000n12021q063:" #(#fn(table.foldl)
- #fn("7000n3182P:" #())) table.values)
+ table-clone #fn("7000n120>215061:" #(#fn("9000n12021>qA5340:" #(#fn(table-foldl)
+ #fn("9000n320A0163:" #(#fn(put!))))) #fn(table)) table-clone)
+ table-foreach #fn("9000n22021>q163:" #(#fn(table-foldl)
+ #fn("8000n3A01524D:" #())) table-foreach)
+ table-invert #fn("7000n120>215061:" #(#fn("9000n12021>qA5340:" #(#fn(table-foldl)
+ #fn("9000n320A1063:" #(#fn(put!))))) #fn(table)) table-invert)
+ table-keys #fn("9000n12021q063:" #(#fn(table-foldl)
+ #fn("7000n3082P:" #())) table-keys)
+ table-pairs #fn("9000n12021q063:" #(#fn(table-foldl)
+ #fn("7000n301P82P:" #())) table-pairs)
+ table-values #fn("9000n12021q063:" #(#fn(table-foldl)
+ #fn("7000n3182P:" #())) table-values)
to-proper #fn("8000n10J400:0H3600e1:0<700=51P:" #(to-proper) to-proper)
top-level-exception-handler #fn("7000n120>7161:" #(#fn("7000n170w1422>23>61:" #(*stderr*
*output-stream* #fn("7000n120>21>}0504:" #(#fn("7000n07092051471225061:" #(print-exception
@@ -461,7 +461,7 @@
values #fn("9000|00B;36040=V3500<:A0P:" #() #2#) vector->list
#fn("8000n120>21051q62:" #(#fn(":000n2K020>~41:" #(#fn("8000n1910A0\x80GFPz01:" #())))
#fn(length)) vector->list)
- vector.map #fn("8000n220>2115161:" #(#fn("8000n120>2105161:" #(#fn(":000n1EAK\x8020>~40:" #(#fn(":000n1A09209210G51p:" #())))
- #fn(vector.alloc))) #fn(length)) vector.map)
+ vector-map #fn("8000n220>2115161:" #(#fn("8000n120>2105161:" #(#fn(":000n1EAK\x8020>~40:" #(#fn(":000n1A09209210G51p:" #())))
+ #fn(vector-alloc))) #fn(length)) vector-map)
void #fn("6000n0D:" #() void) zero?
#fn("7000n10El:" #() zero?))
--- a/gen.lsp
+++ b/gen.lsp
@@ -116,13 +116,13 @@
(lms ())
(i 0))
(begin
- (io.write c-header "enum {\n")
+ (io-write c-header "enum {\n")
(for-each-n
(λ (cop lop argc f)
(begin
- (io.write c-header "\t")
+ (io-write c-header "\t")
(write cop c-header)
- (io.write c-header ",\n")
+ (io-write c-header ",\n")
(put! e lop i)
(if argc (put! cl cop (list lop argc)))
@@ -130,24 +130,24 @@
(set! lms (cons f lms))
(set! i (1+ i))))
opcodes 4)
- (io.write c-header "\tN_OPCODES\n};\n\n")
- (io.write c-header "static const Builtin builtins[] = {\n")
- (table.foreach
- (λ (c la) (begin (io.write c-header "\t[")
- (write c c-header)
- (io.write c-header "] = {\"")
- (write (car la) c-header)
- (io.write c-header "\", ")
- (write (cadr la) c-header)
- (io.write c-header "},\n")))
+ (io-write c-header "\tN_OPCODES\n};\n\n")
+ (io-write c-header "static const Builtin builtins[] = {\n")
+ (table-foreach
+ (λ (c la) (begin (io-write c-header "\t[")
+ (write c c-header)
+ (io-write c-header "] = {\"")
+ (write (car la) c-header)
+ (io-write c-header "\", ")
+ (write (cadr la) c-header)
+ (io-write c-header "},\n")))
cl)
- (io.write c-header "};\n")
- (io.close c-header)
+ (io-write c-header "};\n")
+ (io-close c-header)
(write `(define Instructions ,e) instructions)
- (io.write instructions "\n\n")
+ (io-write instructions "\n\n")
(write `(define arg-counts ,ac) instructions)
- (io.close instructions)
+ (io-close instructions)
(set! lms (cons vector (reverse! lms)))
(write `(define *builtins* ,lms) builtins)
- (io.close builtins)))
+ (io-close builtins)))
--- a/iostream.c
+++ b/iostream.c
@@ -130,7 +130,7 @@
return v;
}
-BUILTIN("io.getc", io_getc)
+BUILTIN("io-getc", io_getc)
{
argcount(nargs, 1);
ios_t *s = fl_toiostream(args[0]);
@@ -144,7 +144,7 @@
return mk_rune(r);
}
-BUILTIN("io.putc", io_putc)
+BUILTIN("io-putc", io_putc)
{
argcount(nargs, 2);
ios_t *s = fl_toiostream(args[0]);
@@ -154,7 +154,7 @@
return fixnum(ios_pututf8(s, r));
}
-BUILTIN("io.skip", io_skip)
+BUILTIN("io-skip", io_skip)
{
argcount(nargs, 2);
ios_t *s = fl_toiostream(args[0]);
@@ -165,13 +165,13 @@
return sizeof(res) == sizeof(int64_t) ? mk_int64(res) : mk_int32(res);
}
-BUILTIN("io.flush", io_flush)
+BUILTIN("io-flush", io_flush)
{
argcount(nargs, 1);
return ios_flush(fl_toiostream(args[0])) == 0 ? FL_T : FL_F;
}
-BUILTIN("io.close", io_close)
+BUILTIN("io-close", io_close)
{
argcount(nargs, 1);
ios_close(fl_toiostream(args[0]));
@@ -178,7 +178,7 @@
return FL_T;
}
-BUILTIN("io.discardbuffer", io_discardbuffer)
+BUILTIN("io-discardbuffer", io_discardbuffer)
{
argcount(nargs, 1);
ios_purge(fl_toiostream(args[0]));
@@ -185,13 +185,13 @@
return FL_T;
}
-BUILTIN("io.eof?", io_eofp)
+BUILTIN("io-eof?", io_eofp)
{
argcount(nargs, 1);
return ios_eof(fl_toiostream(args[0])) ? FL_T : FL_F;
}
-BUILTIN("io.seek", io_seek)
+BUILTIN("io-seek", io_seek)
{
argcount(nargs, 2);
ios_t *s = fl_toiostream(args[0]);
@@ -202,7 +202,7 @@
return FL_T;
}
-BUILTIN("io.pos", io_pos)
+BUILTIN("io-pos", io_pos)
{
argcount(nargs, 1);
ios_t *s = fl_toiostream(args[0]);
@@ -222,7 +222,7 @@
return args[0];
}
-BUILTIN("io.read", io_read)
+BUILTIN("io-read", io_read)
{
if(nargs != 3)
argcount(nargs, 2);
@@ -263,7 +263,7 @@
}
}
-BUILTIN("io.write", io_write)
+BUILTIN("io-write", io_write)
{
if(nargs < 2 || nargs > 4)
argcount(nargs, 2);
@@ -314,7 +314,7 @@
return (char)uldelim;
}
-BUILTIN("io.readuntil", io_readuntil)
+BUILTIN("io-readuntil", io_readuntil)
{
argcount(nargs, 2);
value_t str = cvalue_string(80);
@@ -342,7 +342,7 @@
return str;
}
-BUILTIN("io.copyuntil", io_copyuntil)
+BUILTIN("io-copyuntil", io_copyuntil)
{
argcount(nargs, 3);
ios_t *dest = fl_toiostream(args[0]);
@@ -351,7 +351,7 @@
return size_wrap(ios_copyuntil(dest, src, delim));
}
-BUILTIN("io.copy", io_copy)
+BUILTIN("io-copy", io_copy)
{
if(nargs < 2 || nargs > 3)
argcount(nargs, 2);
@@ -384,7 +384,7 @@
return str;
}
-BUILTIN("io.tostring!", io_tostring)
+BUILTIN("io-tostring!", io_tostring)
{
argcount(nargs, 1);
ios_t *src = fl_toiostream(args[0]);
--- a/mkboot0.lsp
+++ b/mkboot0.lsp
@@ -19,12 +19,12 @@
(update-compiler)
(let ((in (file inf :read)))
(let next ((E (read in)))
- (if (not (io.eof? in))
+ (if (not (io-eof? in))
(begin
(print (compile-thunk (expand E)))
(princ "\n")
(next (read in)))))
- (io.close in)))
+ (io-close in)))
(for-each (λ (file)
(compile-file file))
--- a/mkfile
+++ b/mkfile
@@ -50,6 +50,8 @@
main_plan9.$O: boot.h builtin_fns.h
flisp.$O: maxstack.inc opcodes.h builtin_fns.h
+flmain.$O: boot.h
+builtins.$O: builtin_fns.h
%.$O: %.c
$CC $CFLAGS -o $target $stem.c
--- a/string.c
+++ b/string.c
@@ -15,7 +15,7 @@
return fl_isstring(args[0]) ? FL_T : FL_F;
}
-BUILTIN("string.count", string_count)
+BUILTIN("string-length", string_length)
{
size_t start = 0;
if(nargs < 1 || nargs > 3)
@@ -40,7 +40,7 @@
return size_wrap(u8_charnum(str+start, stop-start));
}
-BUILTIN("string.width", string_width)
+BUILTIN("string-width", string_width)
{
argcount(nargs, 1);
if(iscprim(args[0])){
@@ -53,7 +53,7 @@
return size_wrap(u8_strwidth(tostring(args[0])));
}
-BUILTIN("string.reverse", string_reverse)
+BUILTIN("string-reverse", string_reverse)
{
argcount(nargs, 1);
if(!fl_isstring(args[0]))
@@ -64,7 +64,7 @@
return ns;
}
-BUILTIN("string.encode", string_encode)
+BUILTIN("string-encode", string_encode)
{
argcount(nargs, 1);
if(iscvalue(args[0])){
@@ -84,7 +84,7 @@
type_error("rune array", args[0]);
}
-BUILTIN("string.decode", string_decode)
+BUILTIN("string-decode", string_decode)
{
int term = 0;
if(nargs == 2)
@@ -136,7 +136,7 @@
return outp;
}
-BUILTIN("string.split", string_split)
+BUILTIN("string-split", string_split)
{
argcount(nargs, 2);
char *s = tostring(args[0]);
@@ -179,7 +179,7 @@
return first;
}
-BUILTIN("string.sub", string_sub)
+BUILTIN("string-sub", string_sub)
{
if(nargs != 2)
argcount(nargs, 3);
@@ -205,7 +205,7 @@
return ns;
}
-BUILTIN("string.char", string_char)
+BUILTIN("string-char", string_char)
{
argcount(nargs, 2);
char *s = tostring(args[0]);
@@ -220,7 +220,7 @@
return mk_rune(r);
}
-BUILTIN("char.upcase", char_upcase)
+BUILTIN("char-upcase", char_upcase)
{
argcount(nargs, 1);
cprim_t *cp = (cprim_t*)ptr(args[0]);
@@ -229,7 +229,7 @@
return mk_rune(toupperrune(*(Rune*)cp_data(cp)));
}
-BUILTIN("char.downcase", char_downcase)
+BUILTIN("char-downcase", char_downcase)
{
argcount(nargs, 1);
cprim_t *cp = ptr(args[0]);
@@ -238,7 +238,7 @@
return mk_rune(tolowerrune(*(Rune*)cp_data(cp)));
}
-BUILTIN("char.titlecase", char_titlecase)
+BUILTIN("char-titlecase", char_titlecase)
{
argcount(nargs, 1);
cprim_t *cp = ptr(args[0]);
@@ -301,7 +301,7 @@
return isspacerune(*(Rune*)cp_data(cp)) ? FL_T : FL_F;
}
-BUILTIN("string.find", string_find)
+BUILTIN("string-find", string_find)
{
char cbuf[UTFmax+1];
size_t start = 0;
@@ -396,7 +396,7 @@
return n;
}
-BUILTIN("string.isutf8", string_isutf8)
+BUILTIN("string-utf8?", string_utf8p)
{
argcount(nargs, 1);
char *s = tostring(args[0]);
--- a/system.lsp
+++ b/system.lsp
@@ -136,7 +136,7 @@
(define (random n)
(if (integer? n)
(mod (rand) n)
- (* (rand.double) n)))
+ (* (rand-double) n)))
(define (abs x) (if (< x 0) (- x) x))
(define (max x0 . xs)
(if (null? xs) x0
@@ -587,10 +587,10 @@
(define-macro (time expr)
(let ((t0 (gensym)))
- `(let ((,t0 (time.now)))
+ `(let ((,t0 (time-now)))
(prog1
,expr
- (princ "Elapsed time: " (- (time.now) ,t0) " seconds\n")))))
+ (princ "Elapsed time: " (- (time-now) ,t0) " seconds\n")))))
; text I/O --------------------------------------------------------------------
@@ -600,27 +600,27 @@
(for-each write args)))
(define (newline (port *output-stream*))
- (io.write port *linefeed*)
+ (io-write port *linefeed*)
#t)
-(define (io.readline s) (io.readuntil s #\linefeed))
+(define (io-readline s) (io-readuntil s #\linefeed))
; call f on a stream until the stream runs out of data
(define (read-all-of f s)
(let loop ((lines ())
(curr (f s)))
- (if (io.eof? s)
+ (if (io-eof? s)
(reverse! lines)
(loop (cons curr lines) (f s)))))
-(define (io.readlines s) (read-all-of io.readline s))
+(define (io-readlines s) (read-all-of io-readline s))
(define (read-all s) (read-all-of read s))
-(define (io.readall s)
+(define (io-readall s)
(let ((b (buffer)))
- (io.copy b s)
- (let ((str (io.tostring! b)))
- (if (and (equal? str "") (io.eof? s))
+ (io-copy b s)
+ (let ((str (io-tostring! b)))
+ (if (and (equal? str "") (io-eof? s))
(eof-object)
str))))
@@ -642,9 +642,9 @@
(set! l (cons (aref v (- n i)) l))))
l))
-(define (vector.map f v)
+(define (vector-map f v)
(let* ((n (length v))
- (nv (vector.alloc n)))
+ (nv (vector-alloc n)))
(for 0 (- n 1)
(λ (i)
(aset! nv i (f (aref v i)))))
@@ -652,87 +652,87 @@
; table functions -------------------------------------------------------------
-(define (table.pairs t)
- (table.foldl (λ (k v z) (cons (cons k v) z))
+(define (table-pairs t)
+ (table-foldl (λ (k v z) (cons (cons k v) z))
() t))
-(define (table.keys t)
- (table.foldl (λ (k v z) (cons k z))
+(define (table-keys t)
+ (table-foldl (λ (k v z) (cons k z))
() t))
-(define (table.values t)
- (table.foldl (λ (k v z) (cons v z))
+(define (table-values t)
+ (table-foldl (λ (k v z) (cons v z))
() t))
-(define (table.clone t)
+(define (table-clone t)
(let ((nt (table)))
- (table.foldl (λ (k v z) (put! nt k v))
+ (table-foldl (λ (k v z) (put! nt k v))
() t)
nt))
-(define (table.invert t)
+(define (table-invert t)
(let ((nt (table)))
- (table.foldl (λ (k v z) (put! nt v k))
+ (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))
+(define (table-foreach f t)
+ (table-foldl (λ (k v z) (begin (f k v) #t)) () t))
; string functions ------------------------------------------------------------
-(define (string.tail s n) (string.sub s n))
+(define (string-tail s n) (string-sub s n))
(define *whitespace*
- (string.encode #array(rune 9 10 11 12 13 32 133 160 5760 6158 8192
+ (string-encode #array(rune 9 10 11 12 13 32 133 160 5760 6158 8192
8193 8194 8195 8196 8197 8198 8199 8200
8201 8202 8232 8233 8239 8287 12288)))
-(define (string.trim s at-start at-end)
+(define (string-trim s at-start at-end)
(define (trim-start s chars i L)
(if (and (< i L)
- (string.find chars (string.char s i)))
+ (string-find chars (string-char s i)))
(trim-start s chars (1+ i) L)
i))
(define (trim-end s chars i)
(if (and (> i 0)
- (string.find chars (string.char s i)))
+ (string-find chars (string-char s i)))
(trim-end s chars (1- i))
i))
- (let ((L (string.count s)))
- (string.sub s
+ (let ((L (string-length s)))
+ (string-sub s
(trim-start s at-start 0 L)
(trim-end s at-end L))))
-(define (string.map f s)
+(define (string-map f s)
(let ((b (buffer))
- (n (string.count s)))
+ (n (string-length s)))
(let ((i 0))
(while (< i n)
- (begin (io.putc b (f (string.char s i)))
+ (begin (io-putc b (f (string-char s i)))
(set! i (1+ i)))))
- (io.tostring! b)))
+ (io-tostring! b)))
-(define (string.rep s k)
+(define (string-rep s k)
(cond ((< k 4)
(cond ((<= k 0) "")
((= k 1) (string s))
((= k 2) (string s s))
(else (string s s s))))
- ((odd? k) (string s (string.rep s (- k 1))))
- (else (string.rep (string s s) (/ k 2)))))
+ ((odd? k) (string s (string-rep s (- k 1))))
+ (else (string-rep (string s s) (/ k 2)))))
-(define (string.lpad s n c) (string (string.rep c (- n (string.count s))) s))
-(define (string.rpad s n c) (string s (string.rep c (- n (string.count s)))))
+(define (string-lpad s n c) (string (string-rep c (- n (string-length s))) s))
+(define (string-rpad s n c) (string s (string-rep c (- n (string-length s)))))
(define (print-to-string v)
(let ((b (buffer)))
(write v b)
- (io.tostring! b)))
+ (io-tostring! b)))
-(define (string.join strlist sep)
+(define (string-join strlist sep)
(if (null? strlist) ""
(let ((b (buffer)))
- (io.write b (car strlist))
- (for-each (λ (s) (begin (io.write b sep)
- (io.write b s)))
+ (io-write b (car strlist))
+ (for-each (λ (s) (begin (io-write b sep)
+ (io-write b s)))
(cdr strlist))
- (io.tostring! b))))
+ (io-tostring! b))))
; toplevel --------------------------------------------------------------------
@@ -882,25 +882,25 @@
(let ((F (file filename :read)))
(trycatch
(let next (prev E v)
- (if (not (io.eof? F))
+ (if (not (io-eof? F))
(next (read F)
prev
(load-process E))
- (begin (io.close F)
+ (begin (io-close F)
; evaluate last form in almost-tail position
(load-process E))))
(λ (e)
(begin
- (io.close F)
+ (io-close F)
(raise `(load-error ,filename ,e)))))))
(define (repl)
(define (prompt)
- (princ "> ") (io.flush *output-stream*)
+ (princ "> ") (io-flush *output-stream*)
(let ((v (trycatch (read)
- (λ (e) (begin (io.discardbuffer *input-stream*)
+ (λ (e) (begin (io-discardbuffer *input-stream*)
(raise e))))))
- (and (not (io.eof? *input-stream*))
+ (and (not (io-eof? *input-stream*))
(let ((V (load-process v)))
(print V)
(set! that V)
@@ -937,7 +937,7 @@
e)
#f))))
(if p
- (symbol (string.join (map string (reverse! p)) "/"))
+ (symbol (string-join (map string (reverse! p)) "/"))
'λ)))
(let ((st (reverse! (if (length> st 3)
(list-tail st (if *interactive* 5 4))
@@ -1024,8 +1024,8 @@
(not (iostream? (top-level-value s)))))
(simple-sort (environment)))))
(write (apply nconc (map list syms (map top-level-value syms))) f)
- (io.write f *linefeed*))
- (io.close f))))
+ (io-write f *linefeed*))
+ (io-close f))))
; initialize globals that need to be set at load time
(define (__init_globals)
@@ -1043,9 +1043,9 @@
(define (__rcscript)
(let ((fname (case *os-name*
((unknown) "")
- ((plan9) (string (os.getenv "home") "/lib/flisprc"))
- (else (string (os.getenv "HOME") "/.flisprc")))))
- (if (path.exists? fname) (load fname))))
+ ((plan9) (string (os-getenv "home") "/lib/flisprc"))
+ (else (string (os-getenv "HOME") "/.flisprc")))))
+ (if (path-exists? fname) (load fname))))
(define (__start argv)
(__init_globals)
--- a/table.c
+++ b/table.c
@@ -171,7 +171,7 @@
return args[0];
}
-BUILTIN("table.foldl", table_foldl)
+BUILTIN("table-foldl", table_foldl)
{
argcount(nargs, 3);
value_t f = args[0], zero = args[1], t = args[2];
--- a/test/perf.lsp
+++ b/test/perf.lsp
@@ -28,10 +28,10 @@
(set! L (map-int (lambda (x) (map-int identity 20)) 20))
(time (dotimes (n 1000) (apply my-append L)))
-(path.cwd "ast")
+(path-cwd "ast")
(princ "p-lambda: ")
(load "rpasses.lsp")
(define *input* (load "datetimeR.lsp"))
(time (set! *output* (compile-ish *input*)))
(assert (equal? *output* (load "rpasses-out.lsp")))
-(path.cwd "..")
+(path-cwd "..")
--- a/test/test.lsp
+++ b/test/test.lsp
@@ -217,15 +217,15 @@
(define tt (get *profiles* s))
(define count (car tt))
(define time (cdr tt))
- (define t0 (time.now))
+ (define t0 (time-now))
(define v (apply f args))
- (set-cdr! tt (+ time (- (time.now) t0)))
+ (set-cdr! tt (+ time (- (time-now) t0)))
(set-car! tt (+ count 1))
v)))))
(set! show-profiles
(lambda ()
(define pr (filter (lambda (x) (> (cadr x) 0))
- (table.pairs *profiles*)))
+ (table-pairs *profiles*)))
(define width (+ 4
(apply max
(map (lambda (x)
@@ -232,16 +232,16 @@
(length (string x)))
(cons 'Function
(map car pr))))))
- (princ (string.rpad "Function" width #\ )
+ (princ (string-rpad "Function" width #\ )
"#Calls Time (seconds)")
(newline)
- (princ (string.rpad "--------" width #\ )
+ (princ (string-rpad "--------" width #\ )
"------ --------------")
(newline)
(for-each
(lambda (p)
- (princ (string.rpad (string (caddr p)) width #\ )
- (string.rpad (string (cadr p)) 11 #\ )
+ (princ (string-rpad (string (caddr p)) width #\ )
+ (string-rpad (string (cadr p)) 11 #\ )
(car p))
(newline))
(simple-sort (map (lambda (l) (reverse (to-proper l)))
@@ -250,7 +250,7 @@
(lambda ()
(for-each (lambda (k)
(put! *profiles* k (cons 0 0)))
- (table.keys *profiles*)))))
+ (table-keys *profiles*)))))
#;(for-each profile
'(emit encode-byte-code const-to-idx-vec
@@ -261,7 +261,7 @@
compile-in compile compile-f delete-duplicates
map length> length= count filter append
lastcdr to-proper reverse reverse! list->vector
- table.foreach list-head list-tail assq memq assoc member
+ taboreach list-head list-tail assq memq assoc member
assv memv nreconc bq-process))
(define (filt1 pred lst)
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -314,9 +314,9 @@
(assert (not (equal? (hash (iota 41))
(hash (iota 42)))))
-(if (top-level-bound? 'time.fromstring)
- (assert (let ((ts (time.string (time.now))))
- (eqv? ts (time.string (time.fromstring ts))))))
+(if (top-level-bound? 'string->time)
+ (assert (let ((ts (time->string (time-now))))
+ (eqv? ts (time->string (string->time ts))))))
(assert (equal? 0.0 (+ 0.0 0))) ; tests that + no longer does inexact->exact
@@ -325,7 +325,7 @@
(define (with-output-to-string nada thunk)
(let ((b (buffer)))
(with-output-to b (thunk))
- (io.tostring! b)))
+ (io-tostring! b)))
(let ((c #\a))
(assert (equal? (with-output-to-string #f (lambda () (print (list c c))))