summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2014-01-28 16:54:10 -0500
committerMark H Weaver <mhw@netris.org>2014-01-28 17:15:27 -0500
commitca5e0414e96886177d883a249edd957d2331db65 (patch)
tree23ec0266ad3c2fb147ef6ff33b771d7ba65eb70e
parenta7a4ba6a2de7dee9b5c9e2fa5e0c3caf022c0b14 (diff)
downloadguile-ca5e0414e96886177d883a249edd957d2331db65.tar.gz
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?'.
-rw-r--r--module/language/tree-il/primitives.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/module/language/tree-il/primitives.scm b/module/language/tree-il/primitives.scm
index 15b5c44c9..f140eeca2 100644
--- a/module/language/tree-il/primitives.scm
+++ b/module/language/tree-il/primitives.scm
@@ -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 +