Undoes the 'produces -> return' part of commit c31d352f
, keeping the 'changes -> mutates' change and the assorted bug fixes it contained.
This commit is contained in:
parent
d8d762517f
commit
adf965e92a
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
write-file ;; String String -> String
|
write-file ;; String String -> String
|
||||||
;; (write-file filename str) writes str to filename;
|
;; (write-file filename str) writes str to filename;
|
||||||
;; returns the file name as a confirmation that the write succeeded
|
;; produces the file name as a confirmation that the write succeeded
|
||||||
)
|
)
|
||||||
|
|
||||||
;; -----------------------------------------------------------------------------
|
;; -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
(if r ((third s) r) (fourth s)))
|
(if r ((third s) r) (fourth s)))
|
||||||
Spec))
|
Spec))
|
||||||
|
|
||||||
;; check whether rec? occurs, returns list of keyword x clause pairs
|
;; check whether rec? occurs, produces list of keyword x clause pairs
|
||||||
(define (clauses-use-kwd stx:list ->rec? tag kwds)
|
(define (clauses-use-kwd stx:list ->rec? tag kwds)
|
||||||
(define kwd-in? (->kwds-in kwds))
|
(define kwd-in? (->kwds-in kwds))
|
||||||
(map (lambda (stx)
|
(map (lambda (stx)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
launch-many-worlds
|
launch-many-worlds
|
||||||
;; (launch-many-worlds e1 ... e2)
|
;; (launch-many-worlds e1 ... e2)
|
||||||
;; run expressions e1 through e2 in parallel,
|
;; run expressions e1 through e2 in parallel,
|
||||||
;; return all values
|
;; produce all values
|
||||||
)
|
)
|
||||||
|
|
||||||
(define-syntax-rule
|
(define-syntax-rule
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
(height (if (pair? to-draw) (third to-draw) #f)))
|
(height (if (pair? to-draw) (third to-draw) #f)))
|
||||||
|
|
||||||
;; the visible world
|
;; the visible world
|
||||||
(field [enable-images-button void] ;; used if stop-when call returns #t
|
(field [enable-images-button void] ;; used if stop-when call produces #t
|
||||||
[disable-images-button void]
|
[disable-images-button void]
|
||||||
[visible (new pasteboard%)])
|
[visible (new pasteboard%)])
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@
|
||||||
(show (ppdraw)))
|
(show (ppdraw)))
|
||||||
|
|
||||||
;; -> Scene
|
;; -> Scene
|
||||||
;; return the scene for the this state
|
;; produce the scene for the this state
|
||||||
(define/public (ppdraw)
|
(define/public (ppdraw)
|
||||||
(check-scene-result (name-of draw 'your-draw) (draw (send world get))))
|
(check-scene-result (name-of draw 'your-draw) (draw (send world get))))
|
||||||
|
|
||||||
|
|
|
@ -1380,7 +1380,7 @@
|
||||||
=>
|
=>
|
||||||
128)
|
128)
|
||||||
|
|
||||||
;; Rotation by 0 should return an equivalent object
|
;; Rotation by 0 should produce an equivalent object
|
||||||
(test (rotate 0 (make-object image-snip% green-blue-20x10-bitmap))
|
(test (rotate 0 (make-object image-snip% green-blue-20x10-bitmap))
|
||||||
=>
|
=>
|
||||||
(to-img (make-object image-snip% green-blue-20x10-bitmap)))
|
(to-img (make-object image-snip% green-blue-20x10-bitmap)))
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
(provide
|
(provide
|
||||||
launch-many-worlds
|
launch-many-worlds
|
||||||
;; (launch-many-worlds e1 ... e2)
|
;; (launch-many-worlds e1 ... e2)
|
||||||
;; run expressions e1 through e2 in parallel, return all values in same order
|
;; run expressions e1 through e2 in parallel, produce all values in same order
|
||||||
)
|
)
|
||||||
|
|
||||||
(provide-primitive
|
(provide-primitive
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
;; ******************************************************************
|
;; ******************************************************************
|
||||||
DEFAULT #'(lambda (u w) (make-bundle u '() '()))
|
DEFAULT #'(lambda (u w) (make-bundle u '() '()))
|
||||||
;; this is the wrong default function
|
;; this is the wrong default function
|
||||||
;; instead of K there should be a function that returns a bundle
|
;; instead of K there should be a function that produces a bundle
|
||||||
(function-with-arity 2)
|
(function-with-arity 2)
|
||||||
;; ******************************************************************
|
;; ******************************************************************
|
||||||
]
|
]
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
|
|
||||||
;; ------------------------------------------------------------------------
|
;; ------------------------------------------------------------------------
|
||||||
(define OUT-ERROR
|
(define OUT-ERROR
|
||||||
"The conversion function must return a number, but it returned ~e")
|
"The conversion function must produce a number; but it produced ~e")
|
||||||
|
|
||||||
;; ============================================================================
|
;; ============================================================================
|
||||||
;; MODEL
|
;; MODEL
|
||||||
|
|
|
@ -89,7 +89,7 @@ Use the following vocabulary words to describe how code runs:
|
||||||
|
|
||||||
@itemize[
|
@itemize[
|
||||||
@item{When specifying a function's behavior, say @samp{the function
|
@item{When specifying a function's behavior, say @samp{the function
|
||||||
takes ... and returns ...}}
|
takes ... and produces ...}}
|
||||||
|
|
||||||
@item{When describing a contract violation, say @samp{the function
|
@item{When describing a contract violation, say @samp{the function
|
||||||
expects ... but received ...}}
|
expects ... but received ...}}
|
||||||
|
@ -98,7 +98,7 @@ Use the following vocabulary words to describe how code runs:
|
||||||
to, e.g. @samp{the value of @racket[(f x)] is 5}. If it is necessary to
|
to, e.g. @samp{the value of @racket[(f x)] is 5}. If it is necessary to
|
||||||
mention evaluation order, such as when the context discusses mutable state,
|
mention evaluation order, such as when the context discusses mutable state,
|
||||||
say that the expression @samp{evaluates to} a value. Function calls
|
say that the expression @samp{evaluates to} a value. Function calls
|
||||||
are a special case of expression. Prefer @samp{the function call returns ...}
|
are a special case of expression. Prefer @samp{the function call produces ...}
|
||||||
to @samp{the function call evaluates to ...}, except when trying to draw attention to
|
to @samp{the function call evaluates to ...}, except when trying to draw attention to
|
||||||
the evaluation of the arguments.}
|
the evaluation of the arguments.}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
(define message-panel #f)
|
(define message-panel #f)
|
||||||
|
|
||||||
;; setup-gui : str ->* message% panel%
|
;; setup-gui : str ->* message% panel%
|
||||||
;; to return a status message and a panel where winning/losing can be announced
|
;; to produce a status message and a panel where winning/losing can be announced
|
||||||
;; effect: set up a new frame, arrange the GUI, and display (blank) status word
|
;; effect: set up a new frame, arrange the GUI, and display (blank) status word
|
||||||
(define (setup-gui status)
|
(define (setup-gui status)
|
||||||
(local (#| --------------------------------------------------------------
|
(local (#| --------------------------------------------------------------
|
||||||
|
|
|
@ -157,7 +157,7 @@ they can be syntactically restricted to application positions.
|
||||||
@defform[(first-order->higher-order expression)]{
|
@defform[(first-order->higher-order expression)]{
|
||||||
|
|
||||||
If @racket[expression] is the name of a first-order function (either a
|
If @racket[expression] is the name of a first-order function (either a
|
||||||
primitive or a function defined within Beginner Student), returns the
|
primitive or a function defined within Beginner Student), produces the
|
||||||
function as a value; otherwise, the form is equivalent to
|
function as a value; otherwise, the form is equivalent to
|
||||||
@racket[expression].
|
@racket[expression].
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@
|
||||||
(convert-file IN f2c OUT)
|
(convert-file IN f2c OUT)
|
||||||
(with-input-from-file OUT check-convert-out)
|
(with-input-from-file OUT check-convert-out)
|
||||||
|
|
||||||
(check-error (convert-file IN list OUT) "convert: The conversion function must return a number; but it returned (212)")
|
(check-error (convert-file IN list OUT) "convert: The conversion function must produce a number; but it produced (212)")
|
||||||
|
|
||||||
(check-error (convert-file IN first OUT) "first: expected argument of type <non-empty list>; given 212")
|
(check-error (convert-file IN first OUT) "first: expected argument of type <non-empty list>; given 212")
|
||||||
|
|
||||||
(check-error (convert-file IN fx OUT) "convert: The conversion function must return a number; but it returned xyz")
|
(check-error (convert-file IN fx OUT) "convert: The conversion function must produce a number; but it produced xyz")
|
||||||
|
|
||||||
(check-error (convert-file IN f2c 10) "convert-file: expected <string> as third argument, given: 10")
|
(check-error (convert-file IN f2c 10) "convert-file: expects a string as third argument, given 10")
|
||||||
|
|
||||||
;; ----------------------------------------------------------------------------
|
;; ----------------------------------------------------------------------------
|
||||||
;; convert by repl:
|
;; convert by repl:
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
(with-input-from-string (string (-> any) -> any)
|
(with-input-from-string (string (-> any) -> any)
|
||||||
"Turns the given string into input for read* operations.")
|
"Turns the given string into input for read* operations.")
|
||||||
(with-output-to-string (string (-> any) -> any)
|
(with-output-to-string (string (-> any) -> any)
|
||||||
"Returns a string from all write/display/print operations.")
|
"Produces a string from all write/display/print operations.")
|
||||||
|
|
||||||
|
|
||||||
(print (any -> void)
|
(print (any -> void)
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
(assoc
|
(assoc
|
||||||
(any (listof any) -> (listof any) or false)
|
(any (listof any) -> (listof any) or false)
|
||||||
"Returns the first element on the list whose first is equal? to v; otherwise it returns false."))
|
"Produces the first element on the list whose first is equal? to v; otherwise it produces false."))
|
||||||
|
|
||||||
("Misc"
|
("Misc"
|
||||||
(gensym (-> symbol?)
|
(gensym (-> symbol?)
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
(force (delay -> any) "Finds the delayed value; see also delay.")
|
(force (delay -> any) "Finds the delayed value; see also delay.")
|
||||||
(promise? (any -> boolean) "Determines if a value is delayed.")
|
(promise? (any -> boolean) "Determines if a value is delayed.")
|
||||||
(void (-> void) "Returns a void value.")
|
(void (-> void) "Produces a void value.")
|
||||||
(void? (any -> boolean) "Determines if a value is void."))
|
(void? (any -> boolean) "Determines if a value is void."))
|
||||||
|
|
||||||
("Posns"
|
("Posns"
|
||||||
|
|
|
@ -290,13 +290,13 @@
|
||||||
"Evaluates the number of items on a list.")
|
"Evaluates the number of items on a list.")
|
||||||
(memq (any (listof any) -> (union false list))
|
(memq (any (listof any) -> (union false list))
|
||||||
"Determines whether some value is on some list"
|
"Determines whether some value is on some list"
|
||||||
" if so, it returns the suffix of the list that starts with x"
|
" if so, it produces the suffix of the list that starts with x"
|
||||||
" if not, it returns false."
|
" if not, it produces false."
|
||||||
" (It compares values with the eq? predicate.)")
|
" (It compares values with the eq? predicate.)")
|
||||||
(memv (any (listof any) -> (union false list))
|
(memv (any (listof any) -> (union false list))
|
||||||
"Determines whether some value is on the list"
|
"Determines whether some value is on the list"
|
||||||
" if so, it returns the suffix of the list that starts with x"
|
" if so, it produces the suffix of the list that starts with x"
|
||||||
" if not, it returns false."
|
" if not, it produces false."
|
||||||
" (It compares values with the eqv? predicate.)")
|
" (It compares values with the eqv? predicate.)")
|
||||||
((beginner-member? member?) (any (listof any) -> boolean)
|
((beginner-member? member?) (any (listof any) -> boolean)
|
||||||
"Determines whether some value is on the list"
|
"Determines whether some value is on the list"
|
||||||
|
@ -405,7 +405,7 @@
|
||||||
(string (char ... -> string)
|
(string (char ... -> string)
|
||||||
"Builds a string of the given characters.")
|
"Builds a string of the given characters.")
|
||||||
(make-string (nat char -> string)
|
(make-string (nat char -> string)
|
||||||
"Returns a string of given length"
|
"Produces a string of given length"
|
||||||
" from a single given character.")
|
" from a single given character.")
|
||||||
(string-ref (string nat -> char)
|
(string-ref (string nat -> char)
|
||||||
"Extracts the i-the character from a string.")
|
"Extracts the i-the character from a string.")
|
||||||
|
@ -455,7 +455,7 @@
|
||||||
"Converts a string into a symbol.")
|
"Converts a string into a symbol.")
|
||||||
(string->number (string -> (union number false))
|
(string->number (string -> (union number false))
|
||||||
"Converts a string into a number,"
|
"Converts a string into a number,"
|
||||||
" return false if impossible.")
|
" produce false if impossible.")
|
||||||
(string->list (string -> (listof char))
|
(string->list (string -> (listof char))
|
||||||
"Converts a string into a list of characters.")
|
"Converts a string into a list of characters.")
|
||||||
(list->string ((listof char) -> string)
|
(list->string ((listof char) -> string)
|
||||||
|
|
|
@ -52,10 +52,10 @@
|
||||||
"Finds the (first) element of the list that maximizes the output of the function.")
|
"Finds the (first) element of the list that maximizes the output of the function.")
|
||||||
|
|
||||||
(memf ((X -> any) (listof X) -> (union false (listof X)))
|
(memf ((X -> any) (listof X) -> (union false (listof X)))
|
||||||
"Determines whether the function fiven as the first argument returns a non-false value for any item in the second argument.")
|
"Produces true if the function given as the first argument produces a non-false value for any item in the second argument.")
|
||||||
(apply ((X-1 ... X-N -> Y) X-1 ... X-i (list X-i+1 ... X-N) -> Y)
|
(apply ((X-1 ... X-N -> Y) X-1 ... X-i (list X-i+1 ... X-N) -> Y)
|
||||||
"Applies a function using items from a list as the arguments.")
|
"Applies a function using items from a list as the arguments.")
|
||||||
(compose ((Y-1 -> Z) ... (Y-N -> Y-N-1) (X-1 ... X-N -> Y-N) -> (X-1 ... X-N -> Z))
|
(compose ((Y-1 -> Z) ... (Y-N -> Y-N-1) (X-1 ... X-N -> Y-N) -> (X-1 ... X-N -> Z))
|
||||||
"Composes a sequence of procedures into a single procedure.")
|
"Composes a sequence of procedures into a single procedure.")
|
||||||
(procedure? (any -> boolean)
|
(procedure? (any -> boolean)
|
||||||
"Determines if a value is a procedure."))))
|
"Produces true if the value is a procedure."))))
|
||||||
|
|
|
@ -352,8 +352,8 @@ namespace.
|
||||||
(define r (f i))
|
(define r (f i))
|
||||||
(unless (char? r)
|
(unless (char? r)
|
||||||
(hocheck 'build-string
|
(hocheck 'build-string
|
||||||
"the second argument must be a function that returns a character, ~
|
"the second argument must be a function that produces a character, ~
|
||||||
given ~e, which returned ~e when given ~e" f r i))
|
given ~e, which produced ~e when given ~e" f r i))
|
||||||
r))))
|
r))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,10 +163,10 @@ by @racket[define], @racket[letrec], @racket[let*], or @racket[let].}
|
||||||
|
|
||||||
@defform[(delay expression)]{
|
@defform[(delay expression)]{
|
||||||
|
|
||||||
Returns a ``promise'' to evaluate @racket[expression]. The @racket[expression]
|
Produces a ``promise'' to evaluate @racket[expression]. The @racket[expression]
|
||||||
is not evaluated until the promise is forced with @racket[force]; when
|
is not evaluated until the promise is forced with @racket[force]; when
|
||||||
the promise is forced, the result is recorded, so that any further
|
the promise is forced, the result is recorded, so that any further
|
||||||
@racket[force] of the promise immediately returns the remembered value.}
|
@racket[force] of the promise immediately produces the remembered value.}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ error.}
|
||||||
@defform[(unless test-expression body-expression)]{
|
@defform[(unless test-expression body-expression)]{
|
||||||
|
|
||||||
Like @racket[when], but the @racket[body-expression] is evaluated when the
|
Like @racket[when], but the @racket[body-expression] is evaluated when the
|
||||||
@racket[test-expression] evaluates to @racket[false] instead of @racket[true].}
|
@racket[test-expression] produces @racket[false] instead of @racket[true].}
|
||||||
|
|
||||||
|
|
||||||
@section[#:tag "advanced-common-syntax"]{Common Syntaxes}
|
@section[#:tag "advanced-common-syntax"]{Common Syntaxes}
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
"foldl : first argument must be a function that expects two arguments, given #<procedure:car>")
|
"foldl : first argument must be a function that expects two arguments, given #<procedure:car>")
|
||||||
|
|
||||||
(htdp-err/rt-test (build-string 2 add1)
|
(htdp-err/rt-test (build-string 2 add1)
|
||||||
"build-string : the second argument must be a function that returns a character, given #<procedure:add1>, which returned 1 when given 0")
|
"build-string : the second argument must be a function that produces a character, given #<procedure:add1>, which produced 1 when given 0")
|
||||||
|
|
||||||
(htdp-test 0 '+ (+))
|
(htdp-test 0 '+ (+))
|
||||||
(htdp-test 1 '+ (+ 1))
|
(htdp-test 1 '+ (+ 1))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user