diff --git a/collects/scribblings/reference/for.scrbl b/collects/scribblings/reference/for.scrbl index 978576ccb4..66802c81b0 100644 --- a/collects/scribblings/reference/for.scrbl +++ b/collects/scribblings/reference/for.scrbl @@ -312,29 +312,28 @@ parallel iterations.} @section{Do Loops} @defform/subs[(do ([id init-expr step-expr-maybe] ...) - (cont?-expr finish-expr ...) + (stop?-expr finish-expr ...) expr ...+) ([step-expr-maybe code:blank step-expr])]{ Iteratively evaluates the @scheme[expr]s for as long as -@scheme[cont-expr?] returns @scheme[#t]. +@scheme[stop-expr?] returns @scheme[#f]. To initialize the loop, the @scheme[init-expr]s are evaluated in order and bound to the corresponding @scheme[id]s. The @scheme[id]s are bound in all expressions within the form other than the @scheme[init-expr]s. -After he @scheme[id]s are bound, then @scheme[cont?-expr] is -evaluated. If it produces a true value, then each @scheme[expr] is -evaluated for its side-effect. The @scheme[id]s are then updated with -the values of the @scheme[step-expr]s, where the default -@scheme[step-expr] for @scheme[id] is just @scheme[id]. Iteration -continues by evaluating @scheme[cont?-expr]. +After he @scheme[id]s are bound, then @scheme[stop?-expr] is +evaluated. If it produces @scheme[#f], each @scheme[expr] is evaluated +for its side-effect. The @scheme[id]s are then updated with the values +of the @scheme[step-expr]s, where the default @scheme[step-expr] for +@scheme[id] is just @scheme[id]. Iteration continues by evaluating +@scheme[cont?-expr]. -When @scheme[cont?-expr] produces @scheme[#f], then the +When @scheme[stop?-expr] produces a true value, then the @scheme[finish-expr]s are evaluated in order, and the last one is evaluated in tail position to produce the overall value for the @scheme[do] form. If no @scheme[finish-expr] is provided, the value of the @scheme[do] form is @|void-const|.} - diff --git a/collects/scribblings/reference/numbers.scrbl b/collects/scribblings/reference/numbers.scrbl index e75e30d77e..5f9942be36 100644 --- a/collects/scribblings/reference/numbers.scrbl +++ b/collects/scribblings/reference/numbers.scrbl @@ -569,6 +569,15 @@ produces @scheme[+nan.0] in the case that neither @scheme[y] nor @examples[(bitwise-not 5) (bitwise-not -1)]} +@defproc[(bitwise-bit-set? [n exact-integer?] [m exact-nonnegative-integer?]) + boolean?]{ + +Returns @scheme[(not (zero? (bitwise-and n (arithmetic-shift 1 m))))], +but normally without allocating intermediate results. + +@examples[(bitwise-bit-set? 5 0) (bitwise-bit-set? 5 2) (bitwise-bit-set? -5 (expt 2 700))]} + + @defproc[(arithmetic-shift [n exact-integer?] [m exact-integer?]) exact-integer?]{ Returns the bitwise ``shift'' of @scheme[n] in its (semi-infinite) two's complement representation. If @scheme[m] is @@ -579,7 +588,6 @@ produces @scheme[+nan.0] in the case that neither @scheme[y] nor @examples[(arithmetic-shift 1 10) (arithmetic-shift 255 -3)]} - @defproc[(integer-length [n exact-integer?]) exact-integer?]{ Returns the number of bits in the (semi-infinite) two's complement representation of @scheme[n] after removing all leading zeros (for diff --git a/collects/scribblings/reference/sequences.scrbl b/collects/scribblings/reference/sequences.scrbl index 36f1b964ce..5de85ff3ac 100644 --- a/collects/scribblings/reference/sequences.scrbl +++ b/collects/scribblings/reference/sequences.scrbl @@ -122,6 +122,11 @@ its value from @scheme[hash] (as opposed to using @scheme[hash] directly as a sequence to get the key and value as separate values for each element).} +@defproc[(in-value [v any/c]) sequence]{ +Returns a sequence that produces a single value: @scheme[v]. This form +is mostly useful for @scheme[let]-like bindings in forms such as +@scheme[for*/list].} + @defproc[(in-indexed [seq sequence?]) sequence?]{Returns a sequence where each element has two values: the value produced by @scheme[seq], and a non-negative exact integer starting with @scheme[0]. The