4.2 Booleans
True and false booleans are represented by the values #t and #f, respectively, though operations that depend on a boolean value typically treat anything other than #f as true. The #t value is always eq? to itself, and #f is always eq? to itself.
See Reading Booleans for information on reading booleans and Printing Booleans for information on printing booleans.
See also and, or, andmap, and ormap.
procedure
(immutable? v) → boolean?
v : any/c
Note that immutable? is not a general predicate for
immutability (despite its name). It works only for a handful of
datatypes for which a single predicate—
See also immutable-string?, mutable-string?, etc.
> (immutable? 'hello) #f
> (immutable? "a string") #t
> (immutable? (box 5)) #f
> (immutable? #(0 1 2 3)) #t
> (immutable? (make-hash)) #f
> (immutable? (make-immutable-hash '([a b]))) #t
> (immutable? #t) #f
4.2.1 Boolean Aliases
(require racket/bool) | package: base |
syntax
(nand expr ...)
syntax
(nor expr ...)
In the two argument case, returns #t if neither of the arguments is a true value.
syntax
(implies expr1 expr2)
Same as (if expr1 expr2 #t).
> (implies #f #t) #t
> (implies #f #f) #t
> (implies #t #f) #f
> (implies #f (error 'ack "we don't get here")) #t
If exactly one of b1 and b2 is not #f, then return it. Otherwise, returns #f.
4.2.2 Mutability Predicates
(require racket/mutability) | package: base |
Added in version 8.9.0.3 of package base.
procedure
(mutable-string? v) → boolean?
v : any/c
procedure
(immutable-string? v) → boolean?
v : any/c
procedure
(mutable-bytes? v) → boolean?
v : any/c
procedure
(immutable-bytes? v) → boolean?
v : any/c
procedure
(mutable-vector? v) → boolean?
v : any/c
procedure
(immutable-vector? v) → boolean?
v : any/c
procedure
(mutable-box? v) → boolean?
v : any/c
procedure
(immutable-box? v) → boolean?
v : any/c
procedure
(mutable-hash? v) → boolean?
v : any/c
procedure
(immutable-hash? v) → boolean?
v : any/c