forked from gambit/gambit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define x1 '#f32()) | ||
(define x2 '#f32(1.5 2.5 3.5)) | ||
|
||
(define (which z) | ||
(cond ((##eq? z x1) | ||
"=x1") | ||
((##eq? z x2) | ||
"=x2") | ||
((##eq? z #f) | ||
"=#f") | ||
(else | ||
"not =x1 or =x2 or =#f"))) | ||
|
||
(define (test2 x y) | ||
(println (which (and x y))) | ||
(println (if (and x y) 11 22)) | ||
(println (which (and (##not x) y))) | ||
(println (if (and (##not x) y) 11 22)) | ||
(println (which (and x (##not y)))) | ||
(println (if (and x (##not y)) 11 22)) | ||
(println (which (and (##not x) (##not y)))) | ||
(println (if (and (##not x) (##not y)) 11 22)) | ||
(println (which (##not (and x y)))) | ||
(println (if (##not (and x y)) 11 22)) | ||
(println (which (##not (and (##not x) y)))) | ||
(println (if (##not (and (##not x) y)) 11 22)) | ||
(println (which (##not (and x (##not y))))) | ||
(println (if (##not (and x (##not y))) 11 22)) | ||
(println (which (##not (and (##not x) (##not y))))) | ||
(println (if (##not (and (##not x) (##not y))) 11 22))) | ||
|
||
(define (test x) | ||
(test2 x x1) | ||
(test2 x x2)) | ||
|
||
(test x1) | ||
(test x2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define v1 '#f32()) | ||
(define v2 '#f32(1.5 2.5 3.5)) | ||
|
||
(define (test2 x y) | ||
(println (##eq? x y)) | ||
(println (if (##eq? x y) 11 22))) | ||
|
||
(define (test x) | ||
(test2 x v1) | ||
(test2 x v2)) | ||
|
||
(test v1) | ||
(test v2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define v1 '#f32()) | ||
(define v2 '#f32(1.5 2.5 3.5)) | ||
|
||
(define (test x) | ||
(println (if x 11 22))) | ||
|
||
(test v1) | ||
(test v2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define f (##not 123)) | ||
(define t (##not f)) | ||
(define s "") | ||
(define x 1.5) | ||
(define y (##make-f32vector 2 5.5)) | ||
(define z (##list 1 2 3)) | ||
|
||
(define (test x) | ||
(println (##f32vector? x)) | ||
(println (if (##f32vector? x) 11 22))) | ||
|
||
(test 0) | ||
(test 1) | ||
(test f) | ||
(test t) | ||
(test s) | ||
(test x) | ||
(test y) | ||
(test z) | ||
(test (##cdr z)) | ||
|
||
(println (##f32vector-ref y 0)) | ||
(println (##f32vector-ref y 1)) | ||
(##f32vector-set! y 1 9.5) | ||
(println (##f32vector-ref y 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define v1 '#f32()) | ||
(define v2 '#f32(1.5 2.5 3.5)) | ||
|
||
(define (test x) | ||
(println (if (##not x) 11 22))) | ||
|
||
(test v1) | ||
(test v2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define x1 '#f32()) | ||
(define x2 '#f32(1.5 2.5 3.5)) | ||
|
||
(define (which z) | ||
(cond ((##eq? z x1) | ||
"=x1") | ||
((##eq? z x2) | ||
"=x2") | ||
((##eq? z #f) | ||
"=#f") | ||
(else | ||
"not =x1 or =x2 or =#f"))) | ||
|
||
(define (test2 x y) | ||
(println (which (or x y))) | ||
(println (if (or x y) 11 22)) | ||
(println (which (or (##not x) y))) | ||
(println (if (or (##not x) y) 11 22)) | ||
(println (which (or x (##not y)))) | ||
(println (if (or x (##not y)) 11 22)) | ||
(println (which (or (##not x) (##not y)))) | ||
(println (if (or (##not x) (##not y)) 11 22)) | ||
(println (which (##not (or x y)))) | ||
(println (if (##not (or x y)) 11 22)) | ||
(println (which (##not (or (##not x) y)))) | ||
(println (if (##not (or (##not x) y)) 11 22)) | ||
(println (which (##not (or x (##not y))))) | ||
(println (if (##not (or x (##not y))) 11 22)) | ||
(println (which (##not (or (##not x) (##not y))))) | ||
(println (if (##not (or (##not x) (##not y))) 11 22))) | ||
|
||
(define (test x) | ||
(test2 x x1) | ||
(test2 x x2)) | ||
|
||
(test x1) | ||
(test x2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define f (##not 123)) | ||
(define t (##not f)) | ||
(define s "") | ||
(define x 1.5) | ||
(define y (##f32vector 1.5 2.5)) | ||
(define z (##list 1 2 3)) | ||
|
||
(define (test x) | ||
(println (##f32vector? x)) | ||
(println (if (##f32vector? x) 11 22))) | ||
|
||
(test 0) | ||
(test 1) | ||
(test f) | ||
(test t) | ||
(test s) | ||
(test x) | ||
(test y) | ||
(test z) | ||
(test (##cdr z)) | ||
|
||
(println (##f32vector-ref y 0)) | ||
(println (##f32vector-ref y 1)) | ||
(##f32vector-set! y 1 9.5) | ||
(println (##f32vector-ref y 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define a (##f32vector 1.5 2.5)) | ||
(define b (##make-f32vector 10 5.5)) | ||
(define c '#f32(1.5 2.5 3.5 4.5)) | ||
|
||
(define (test v) | ||
(println (##f32vector-length v))) | ||
|
||
(test a) | ||
(test b) | ||
(test c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define v1 (##f32vector 1.5 2.5)) | ||
(define v2 (##make-f32vector 10 5.5)) | ||
(define v3 '#f32(1.5 2.5 3.5 4.5)) | ||
|
||
(define (test v i) | ||
(println (##f32vector-ref v i))) | ||
|
||
(test v1 0) | ||
(test v1 1) | ||
|
||
(test v2 9) | ||
|
||
(test v3 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define v1 (##f32vector 1.5 2.5)) | ||
(define v2 (##make-f32vector 10 5.5)) | ||
|
||
(define (test v i) | ||
(println (##f32vector-ref v i)) | ||
(println (##eq? v (##f32vector-set! v i 9.5))) | ||
(println (##f32vector-ref v i))) | ||
|
||
(test v1 1) | ||
(test v2 9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(declare (extended-bindings) (not constant-fold) (not safe)) | ||
|
||
(define v1 (##f32vector 1.5 2.5)) | ||
(define v2 (##make-f32vector 10 5.5)) | ||
|
||
(define (test v n) | ||
(println (##eq? v (##f32vector-shrink! v n))) | ||
(println (##f32vector-length v))) | ||
|
||
(test v1 1) | ||
(test v2 5) |