mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
Add 'positive?' and 'negative?' as primitives.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*) (*effect-free-primitives*): Add 'positive?' and 'negative?'. (*primitive-expand-table*): Add primitive expanders for 'positive?' and 'negative?'.
This commit is contained in:
parent
a7a4ba6a2d
commit
ca5e0414e9
1 changed files with 9 additions and 3 deletions
|
@ -35,7 +35,7 @@
|
|||
|
||||
;; When adding to this, be sure to update *multiply-valued-primitives*
|
||||
;; if appropriate.
|
||||
(define *interesting-primitive-names*
|
||||
(define *interesting-primitive-names*
|
||||
'(apply @apply
|
||||
call-with-values @call-with-values
|
||||
call-with-current-continuation @call-with-current-continuation
|
||||
|
@ -45,7 +45,7 @@
|
|||
values
|
||||
eq? eqv? equal?
|
||||
memq memv
|
||||
= < > <= >= zero?
|
||||
= < > <= >= zero? positive? negative?
|
||||
+ * - / 1- 1+ quotient remainder modulo
|
||||
ash logand logior logxor lognot
|
||||
not
|
||||
|
@ -150,7 +150,7 @@
|
|||
(define *effect-free-primitives*
|
||||
`(values
|
||||
eq? eqv? equal?
|
||||
= < > <= >= zero?
|
||||
= < > <= >= zero? positive? negative?
|
||||
ash logand logior logxor lognot
|
||||
+ * - / 1- 1+ quotient remainder modulo
|
||||
not
|
||||
|
@ -331,6 +331,12 @@
|
|||
(define-primitive-expander zero? (x)
|
||||
(= x 0))
|
||||
|
||||
(define-primitive-expander positive? (x)
|
||||
(> x 0))
|
||||
|
||||
(define-primitive-expander negative? (x)
|
||||
(< x 0))
|
||||
|
||||
;; FIXME: All the code that uses `const?' is redundant with `peval'.
|
||||
|
||||
(define-primitive-expander +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue