History

fix broken >= and <=

Sigrid Solveig Haflínudóttir committed 1 year ago

Commit 8e5d5781 parent 9db91975 files · +28 −12Browse files

Unified · Split

5 files
  1. compiler.lsp +1 −1
  2. flisp.boot +8 −6
  3. flisp.boot.builtin +0 −0
  4. system.lsp +14 −6
  5. test/unittest.lsp +6 −0
compiler.lsp+1−1
@@ -486,7 +486,7 @@ · 485 unmodified lines
486 486
487;; lambda, main compilation loop487;; lambda, main compilation loop
488 488
489(define (fits-i8 x) (and (fixnum? x) (>= x -128) (<= x 127)))489(define (fits-i8 x) (and (fixnum? x) (>= 127 x -128)))
490 490
491(define (compile-in g env tail? x (outl #f))491(define (compile-in g env tail? x (outl #f))
492 (cond ((symbol? x) (compile-sym g env x #t))492 (cond ((symbol? x) (compile-sym g env x #t))
flisp.boot+8−6
@@ -48,11 +48,13 @@ · 47 unmodified lines
48 1+ #fn("6000n10KM:" #() 1+) 1-48 1+ #fn("6000n10KM:" #() 1+) 1-
49 #fn("6000n10K~:" #() 1-) 1arg-lambda? #fn("7000n10B;3E04700<51;3:04710TK62:" #(is-lambda?49 #fn("6000n10K~:" #() 1-) 1arg-lambda? #fn("7000n10B;3E04700<51;3:04710TK62:" #(is-lambda?
50 length=) 1arg-lambda?)50 length=) 1arg-lambda?)
51 <= #fn("9000z0700f2;I:047172052S:" #(> every nan?) <=) >51 <= #fn("<000z1\x8d\x8a620862186>1_51486<0152S:" #(#0#
52 #fn("<000z1\x8d\x8a620862186>1_51486<0162:" #(#0#52 #fn("7000n21J40O:1<0L2;IE0470051;I;04A<1<1=62:" #(nan?) f)) <=)
53 #fn("7000n21V;IE041<0L2;3;04A<1<1=62:" #() f)) >)53 > #fn("<000z1\x8d\x8a620862186>1_51486<0162:" #(#0#
54 >= #fn("9000z0700f2;I:047172052S:" #(< every nan?) >=) Instructions54 #fn("7000n21V;IE041<0L2;3;04A<1<1=62:" #() f)) >)
55 #table(call.l 81 trycatch 75 largc 79 loadg.l 68 aref2 23 box 90 cadr 36 argc 62 setg 71 load0 21 vector? 45 fixnum? 41 loadc0 17 loada0 0 div0 59 keyargs 89 call 5 loada.l 69 brt.l 50 sub2 78 add2 29 loadc.l 70 loadc 9 builtin? 43 set-car! 47 brt 25 ret 10 loadi8 66 tapply 77 loadvoid 93 loada1 1 shift 46 boolean? 39 atom? 24 cdr 13 brne.l 83 / 58 loadf 31 equal? 52 apply 54 dup 11 loadt 20 jmp.l 48 null? 38 not 35 = 60 set-cdr! 30 eq? 33 * 57 load1 27 bound? 42 brf 3 function? 44 box.l 91 < 28 brnn.l 84 jmp 16 loadv 2 for 76 lvargc 80 dummy_eof 94 + 55 brne 19 compare 61 neg 37 loadv.l 67 number? 40 vargc 74 brn 85 brbound 88 vector 63 loadc1 22 setg.l 72 cons? 18 brf.l 49 aref 92 symbol? 34 aset! 64 car 12 cons 32 tcall.l 82 - 56 brn.l 86 optargs 87 closure 14 pop 4 eqv? 51 list 53 seta 15 seta.l 73 brnn 26 loadnil 65 loadg 7 loada 8 tcall 6)55 >= #fn("<000z1\x8d\x8a620862186>1_51486<0152S:" #(#0#
56 #fn("7000n21J40O:01<L2;IE0470051;I;04A<1<1=62:" #(nan?) f)) >=)
57 Instructions #table(call.l 81 trycatch 75 largc 79 loadg.l 68 aref2 23 box 90 cadr 36 argc 62 setg 71 load0 21 vector? 45 fixnum? 41 loadc0 17 loada0 0 div0 59 keyargs 89 call 5 loada.l 69 brt.l 50 sub2 78 add2 29 loadc.l 70 loadc 9 builtin? 43 set-car! 47 brt 25 ret 10 loadi8 66 tapply 77 loadvoid 93 loada1 1 shift 46 boolean? 39 atom? 24 cdr 13 brne.l 83 / 58 loadf 31 equal? 52 apply 54 dup 11 loadt 20 jmp.l 48 null? 38 not 35 = 60 set-cdr! 30 eq? 33 * 57 load1 27 bound? 42 brf 3 function? 44 box.l 91 < 28 brnn.l 84 jmp 16 loadv 2 for 76 lvargc 80 dummy_eof 94 + 55 brne 19 compare 61 neg 37 loadv.l 67 number? 40 vargc 74 brn 85 brbound 88 vector 63 loadc1 22 setg.l 72 cons? 18 brf.l 49 aref 92 symbol? 34 aset! 64 car 12 cons 32 tcall.l 82 - 56 brn.l 86 optargs 87 closure 14 pop 4 eqv? 51 list 53 seta 15 seta.l 73 brnn 26 loadnil 65 loadg 7 loada 8 tcall 6)
56 __init_globals #fn("5000n020w1422w3424w5476w7478w947:w;:" #(#fn("6000n0702161:" #(princ58 __init_globals #fn("5000n020w1422w3424w5476w7478w947:w;:" #(#fn("6000n0702161:" #(princ
57 "#;> ")) *prompt* "/" *directory-separator* "\n" *linefeed* *stdout* *output-stream* *stdin*59 "#;> ")) *prompt* "/" *directory-separator* "\n" *linefeed* *stdout* *output-stream* *stdin*
58 *input-stream* *stderr*60 *input-stream* *stderr*
@@ -243,7 +245,7 @@ · 184 unmodified lines
243 extend-env #fn("8000n370182E530P:" #(vars-to-env) extend-env) filter245 extend-env #fn("8000n370182E530P:" #(vars-to-env) extend-env) filter
244 #fn("9000n2\x8d20210>1?65148601qe163:" #(#0#246 #fn("9000n2\x8d20210>1?65148601qe163:" #(#0#
245 #fn("8000n382\x8d1B3Q04A1<513?0821<qPN=?2@30O41=?1@\x0e/4=:" #() filter-)) filter)247 #fn("8000n382\x8d1B3Q04A1<513?0821<qPN=?2@30O41=?1@\x0e/4=:" #() filter-)) filter)
246 fits-i8 #fn("7000n10Y;3F04700r\xb052;3:04710r\xaf62:" #(>= <=) fits-i8) foldl248 fits-i8 #fn("8000n10Y;3<0470r\xaf0r\xb063:" #(>=) fits-i8) foldl
247 #fn("9000n382J401:700082<15282=63:" #(foldl) foldl) foldr #fn(":000n382J401:082<700182=5362:" #(foldr) foldr)249 #fn("9000n382J401:700082<15282=63:" #(foldl) foldl) foldr #fn(":000n382J401:082<700182=5362:" #(foldr) foldr)
248 get-defined-vars #fn("7000n170A<05161:" #(delete-duplicates) #(#2=(#fn("8000n10H340q:0<20Cj00=B3d00TR;37040Te1;IS040TB;3E0471051R;3:0471051e1;I404q:0<22C?07324A<0=52}2:q:" #(define250 get-defined-vars #fn("7000n170A<05161:" #(delete-duplicates) #(#2=(#fn("8000n10H340q:0<20Cj00=B3d00TR;37040Te1;IS040TB;3E0471051R;3:0471051e1;I404q:0<22C?07324A<0=52}2:q:" #(define
249 caadr begin nconc #fn(map)) #(#2#)))))251 caadr begin nconc #fn(map)) #(#2#)))))
flisp.boot.builtin+0−0

Binary file not shown.

system.lsp+14−6
@@ -184,13 +184,21 @@ it." · 183 unmodified lines
184(define-macro (> a . rest)184(define-macro (> a . rest)
185 `(< ,@(reverse! rest) ,a))185 `(< ,@(reverse! rest) ,a))
186 186
187(define (<= . rest)187(define (<= a . rest)
188 (not (or (apply > rest)188 (define (f a rest)
189 (every nan? rest))))189 (unless (null? rest)
190 (or (< (car rest) a)
191 (nan? a)
192 (f (car rest) (cdr rest)))))
193 (not (f a rest)))
190 194
191(define (>= . rest)195(define (>= a . rest)
192 (not (or (apply < rest)196 (define (f a rest)
193 (every nan? rest))))197 (unless (null? rest)
198 (or (< a (car rest))
199 (nan? a)
200 (f (car rest) (cdr rest)))))
201 (not (f a rest)))
194 202
195(define (negative? x) (< x 0))203(define (negative? x) (< x 0))
196(define (zero? x) (= x 0))204(define (zero? x) (= x 0))
test/unittest.lsp+6−0
@@ -148,6 +148,12 @@ · 147 unmodified lines
148(assert (>= "ab" "aa"))148(assert (>= "ab" "aa"))
149(assert (>= "ab" "aa" "aa"))149(assert (>= "ab" "aa" "aa"))
150 150
151; one or more than two arguments
152(assert (and (> 0) (< 0) (>= 0) (<= 0)))
153(assert (and (> 2 1 0) (< 0 1 2) (>= 2 1 0) (<= 0 1 2)))
154(assert (and (>= 2 1 1) (<= 1 1 2)))
155(assert (not (and (>= 2 1 2) (<= 2 1 2))))
156
151; comparing numbers and runes157; comparing numbers and runes
152(assert (< 9 #\newline))158(assert (< 9 #\newline))
153(assert (not (< 10 #\newline)))159(assert (not (< 10 #\newline)))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t