closes PR 14744 , Rackety
This commit is contained in:
parent
404c067286
commit
0f78892a0b
|
@ -3,15 +3,15 @@
|
|||
;; define a primitive operator that consumes a procedure.
|
||||
;; See manual for more information.
|
||||
|
||||
(module prim mzscheme
|
||||
(require lang/error
|
||||
(rename lang/htdp-beginner beginner-app #%app))
|
||||
#lang mzscheme
|
||||
(require lang/error
|
||||
(rename lang/htdp-beginner beginner-app #%app))
|
||||
|
||||
(require-for-syntax (prefix fo: "private/firstorder.rkt")
|
||||
(require-for-syntax (prefix fo: "private/firstorder.rkt")
|
||||
stepper/private/syntax-property)
|
||||
|
||||
(provide define-primitive
|
||||
define-higher-order-primitive
|
||||
(provide define-primitive
|
||||
define-higher-order-primitive
|
||||
provide-primitive
|
||||
provide-higher-order-primitive
|
||||
provide-primitives
|
||||
|
@ -167,6 +167,4 @@
|
|||
(with-syntax ([ex-name ((make-syntax-introducer) #'name)])
|
||||
#'(begin
|
||||
(define-higher-order-primitive ex-name name (arg ...))
|
||||
(provide ex-name)))])))
|
||||
|
||||
|
||||
(provide ex-name)))]))
|
||||
|
|
|
@ -276,9 +276,21 @@
|
|||
@interaction[#:eval (bsl) (even? 2)]
|
||||
}
|
||||
@defproc[(rational? [x any/c]) boolean?]{
|
||||
Determines whether some value is a rational number.
|
||||
@interaction[#:eval (bsl) (rational? 1-2i)]
|
||||
}
|
||||
Determines whether some value is a rational number.
|
||||
@interaction[#:eval (bsl)
|
||||
(rational? 1)
|
||||
(rational? -2.349)
|
||||
(rational? #i1.23456789)
|
||||
(rational? (sqrt -1))
|
||||
(rational? pi)
|
||||
(rational? e)
|
||||
(rational? 1-2i)]
|
||||
As the interactions show, the teaching languages considers many more
|
||||
numbers as rationals than expected. In particular, @racket[pi] is a
|
||||
rational number because it is only a finite approximation to the
|
||||
mathematical π. Think of @racket[rational?] as a suggestion to think of
|
||||
these numbers as fractions.
|
||||
}
|
||||
@defproc[(inexact? [x number]) boolean?]{
|
||||
Determines whether some number is inexact.
|
||||
@interaction[#:eval (bsl) (inexact? 1-2i)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user