Commit 6f80b4f
authored
Add a few improvements for predicates in cptype, in particular for zero? (cisco#960)
* Allow #f and (void) as results of primitive handlers in cptypes
The speciliation handlers can return #f or (void)
in case they don't want to make changes, and then
the default is used.
The use of #f is similar to `define-inline` in cp0,
but (void) allows to use `when`or `cond` to select
the useful cases.
* Improve predicates handling in cptype
When a primitive is marked as a predicate and has a
handler, then try to reduce it as a predicate and then
call the handler for more specific reductions.
* Add rational? to cptypes
* Improve support of zero? in cptypes
In particular, reduce
(if (zero? x) (zero? x) (zero? x))
=>
(if (zero? x) #t #f)
=>
(zero? x)
* Track 0.0 and -0.0 in cptypes
It useful to reduce
(cond
[(eqv? x 0.0) ...]
[(eqv? x -0.0) ...]
[(flzero? x) ...] ; this can be eliminated
[...])1 parent 07b679b commit 6f80b4f
File tree
6 files changed
+315
-243
lines changed- mats
- release_notes
- s
6 files changed
+315
-243
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
611 | 617 | | |
612 | 618 | | |
613 | 619 | | |
| |||
663 | 669 | | |
664 | 670 | | |
665 | 671 | | |
| 672 | + | |
| 673 | + | |
666 | 674 | | |
667 | 675 | | |
668 | 676 | | |
| |||
683 | 691 | | |
684 | 692 | | |
685 | 693 | | |
| 694 | + | |
| 695 | + | |
686 | 696 | | |
687 | 697 | | |
688 | 698 | | |
| |||
900 | 910 | | |
901 | 911 | | |
902 | 912 | | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
903 | 922 | | |
904 | 923 | | |
905 | 924 | | |
| |||
909 | 928 | | |
910 | 929 | | |
911 | 930 | | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
912 | 949 | | |
913 | 950 | | |
914 | 951 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
421 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
422 | 426 | | |
423 | 427 | | |
424 | 428 | | |
425 | | - | |
| 429 | + | |
426 | 430 | | |
427 | 431 | | |
428 | 432 | | |
| |||
432 | 436 | | |
433 | 437 | | |
434 | 438 | | |
| 439 | + | |
435 | 440 | | |
436 | 441 | | |
437 | 442 | | |
| |||
462 | 467 | | |
463 | 468 | | |
464 | 469 | | |
| 470 | + | |
465 | 471 | | |
466 | 472 | | |
467 | 473 | | |
| |||
528 | 534 | | |
529 | 535 | | |
530 | 536 | | |
| 537 | + | |
531 | 538 | | |
532 | 539 | | |
533 | 540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
0 commit comments