positive and negative predicates
This commit is contained in:
parent
48e9bbc518
commit
d2a0a17056
|
@ -1298,6 +1298,24 @@
|
|||
});
|
||||
|
||||
|
||||
installPrimitiveProcedure(
|
||||
'positive?',
|
||||
1,
|
||||
function(MACHINE) {
|
||||
var n = checkReal(MACHINE, 'positive?', 0);
|
||||
return baselib.numbers.greaterThan(n, 0);
|
||||
});
|
||||
|
||||
installPrimitiveProcedure(
|
||||
'negative?',
|
||||
1,
|
||||
function(MACHINE) {
|
||||
var n = checkReal(MACHINE, 'negative?', 0);
|
||||
return baselib.numbers.lessThan(n, 0);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -315,8 +315,8 @@ exact-nonnegative-integer?
|
|||
odd?
|
||||
even?
|
||||
zero?
|
||||
;; positive?
|
||||
;; negative?
|
||||
positive?
|
||||
negative?
|
||||
;; box?
|
||||
;; hash?
|
||||
|
||||
|
|
|
@ -15,3 +15,17 @@ false
|
|||
1
|
||||
3
|
||||
3
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
|
|
|
@ -19,4 +19,20 @@
|
|||
(min 3 4 5 6)
|
||||
(min 3 1 4 1 5 9 2 6)
|
||||
(min 3 20)
|
||||
(min 20 3)
|
||||
(min 20 3)
|
||||
|
||||
|
||||
(positive? 0)
|
||||
(negative? 0)
|
||||
(positive? 42)
|
||||
(negative? 42)
|
||||
(positive? -42)
|
||||
(negative? -42)
|
||||
(positive? 3.1415926)
|
||||
(negative? 3.1415926)
|
||||
(positive? -3.1415926)
|
||||
(negative? -3.1415926)
|
||||
(positive? (expt 2 100))
|
||||
(negative? (expt 2 100))
|
||||
(positive? (expt -2 91))
|
||||
(negative? (expt -2 91))
|
Loading…
Reference in New Issue
Block a user