add 'false?'

svn: r9849
This commit is contained in:
Matthew Flatt 2008-05-15 16:03:50 +00:00
parent 02485e1e50
commit 26a36a9cbe
4 changed files with 14 additions and 2 deletions

View File

@ -186,6 +186,9 @@
(boolean=? (boolean boolean -> boolean) (boolean=? (boolean boolean -> boolean)
"to determine whether two booleans are equal") "to determine whether two booleans are equal")
(false? (any -> boolean)
"to determine whether a value is false")
((beginner-not not) (boolean -> boolean) ((beginner-not not) (boolean -> boolean)
"to compute the negation of a boolean value")) "to compute the negation of a boolean value"))

View File

@ -116,6 +116,8 @@ namespace.
(define (positive-real? v) (define (positive-real? v)
(and (real? v) (>= v 0))) (and (real? v) (>= v 0)))
(define (false? v) (eq? v #f))
(define-teach beginner not (define-teach beginner not
(lambda (a) (lambda (a)
(unless (boolean? a) (unless (boolean? a)
@ -336,7 +338,9 @@ namespace.
(check-last/cycle 'append x) (check-last/cycle 'append x)
(apply append x))) (apply append x)))
(provide beginner-not (provide
false?
beginner-not
beginner-+ beginner-+
beginner-/ beginner-/
beginner-* beginner-*

View File

@ -1,6 +1,6 @@
#lang scheme/base #lang scheme/base
(provide true false (provide true false false?
boolean=? boolean=?
symbol=?) symbol=?)
@ -15,6 +15,8 @@
(define-constant true #t) (define-constant true #t)
(define-constant false #f) (define-constant false #f)
(define (false? v) (eq? v #f))
(define (boolean=? x y) (define (boolean=? x y)
(unless (and (boolean? x) (boolean? y)) (unless (and (boolean? x) (boolean? y))
(raise-type-error 'boolean=? "boolean" (if (boolean? x) 1 0) x y)) (raise-type-error 'boolean=? "boolean" (if (boolean? x) 1 0) x y))

View File

@ -135,3 +135,6 @@ Returns @scheme[(equal? a b)].}
Returns @scheme[(equal? a b)].} Returns @scheme[(equal? a b)].}
@defproc[(false? [v any/c]) boolean?]{
Returns @scheme[(not v)].}