doc addition and prose tweaks
svn: r18376
This commit is contained in:
parent
831dcc0c2c
commit
2caaf05ca6
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
@title[#:tag "scripts"]{Scripts}
|
@title[#:tag "scripts"]{Scripts}
|
||||||
|
|
||||||
Scheme files can be turned into executable scripts on Unix and Mac OS
|
Scheme files can be turned into executable scripts under Unix and Mac
|
||||||
X. On Windows, one option is to use a compatibility layer like Cygwin,
|
OS X. Under Windows, a compatibility layer like Cygwin support the
|
||||||
or write scripts as batch files.
|
same kind of scripts, or scripts can be implemented as batch files.
|
||||||
|
|
||||||
@section{Unix Scripts}
|
@section{Unix Scripts}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ the script file turns out to be valid input to both @exec{/bin/sh} and
|
||||||
@section{Windows Batch Files}
|
@section{Windows Batch Files}
|
||||||
|
|
||||||
A similar trick can be used to write Scheme code in Windows
|
A similar trick can be used to write Scheme code in Windows
|
||||||
@as-index{@tt{batch}} files:
|
@as-index{@tt{.bat}} batch files:
|
||||||
|
|
||||||
@verbatim[#:indent 2]|{
|
@verbatim[#:indent 2]|{
|
||||||
; @echo off
|
; @echo off
|
||||||
|
|
|
@ -589,9 +589,9 @@ produces @scheme[+nan.0] in the case that neither @scheme[y] nor
|
||||||
Returns @scheme[#t] when the @scheme[m]th bit of @scheme[n] is set in @scheme[n]'s
|
Returns @scheme[#t] when the @scheme[m]th bit of @scheme[n] is set in @scheme[n]'s
|
||||||
(semi-infinite) two's complement representation.
|
(semi-infinite) two's complement representation.
|
||||||
|
|
||||||
This is equivalent to
|
This operation is equivalent to
|
||||||
@scheme[(not (zero? (bitwise-and n (arithmetic-shift 1 m))))],
|
@scheme[(not (zero? (bitwise-and n (arithmetic-shift 1 m))))],
|
||||||
but is faster and runs in constant time when @scheme[n] is positive.
|
but it is faster and runs in constant time when @scheme[n] is positive.
|
||||||
|
|
||||||
@mz-examples[(bitwise-bit-set? 5 0) (bitwise-bit-set? 5 2) (bitwise-bit-set? -5 (expt 2 700))]}
|
@mz-examples[(bitwise-bit-set? 5 0) (bitwise-bit-set? 5 2) (bitwise-bit-set? -5 (expt 2 700))]}
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ but is faster and runs in constant time when @scheme[n] is positive.
|
||||||
Extracts the bits between position @scheme[start] and @scheme[(- end 1)] (inclusive)
|
Extracts the bits between position @scheme[start] and @scheme[(- end 1)] (inclusive)
|
||||||
from @scheme[n] and shifts them down to the least significant portion of the number.
|
from @scheme[n] and shifts them down to the least significant portion of the number.
|
||||||
|
|
||||||
This is equivalent to this computation,
|
This operation is equivalent to the computation
|
||||||
|
|
||||||
@schemeblock[
|
@schemeblock[
|
||||||
(bitwise-and (sub1 (arithmetic-shift 1 (- end start)))
|
(bitwise-and (sub1 (arithmetic-shift 1 (- end start)))
|
||||||
|
@ -616,8 +616,8 @@ but it runs in constant time when @scheme[n] is positive, @scheme[start] and
|
||||||
@scheme[end] are fixnums, and @scheme[(- end start)] is no more than
|
@scheme[end] are fixnums, and @scheme[(- end start)] is no more than
|
||||||
the maximum width of a fixnum.
|
the maximum width of a fixnum.
|
||||||
|
|
||||||
Each pair of examples below uses the same numbers, but shows the result in
|
Each pair of examples below uses the same numbers, showing the result
|
||||||
both binary and as integers.
|
both in binary and as integers.
|
||||||
|
|
||||||
@mz-examples[(format "~b" (bitwise-bit-field (string->number "1101" 2) 1 1))
|
@mz-examples[(format "~b" (bitwise-bit-field (string->number "1101" 2) 1 1))
|
||||||
(bitwise-bit-field 13 1 1)
|
(bitwise-bit-field 13 1 1)
|
||||||
|
|
|
@ -48,6 +48,12 @@ that they appear as @scheme[v]s, so in the first two cases, an earlier
|
||||||
element that is @scheme[equal?] or @scheme[eqv?] but not @scheme[eq?]
|
element that is @scheme[equal?] or @scheme[eqv?] but not @scheme[eq?]
|
||||||
to a later element takes precedence over the later element.}
|
to a later element takes precedence over the later element.}
|
||||||
|
|
||||||
|
|
||||||
|
@defproc[(set-empty? [set set?]) boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if @scheme[set] has no members, @scheme[@f]
|
||||||
|
otherwise.}
|
||||||
|
|
||||||
@defproc[(set-member? [set set?] [v any/c]) boolean?]{
|
@defproc[(set-member? [set set?] [v any/c]) boolean?]{
|
||||||
|
|
||||||
Returns @scheme[#t] if @scheme[v] is in @scheme[set], @scheme[#f]
|
Returns @scheme[#t] if @scheme[v] is in @scheme[set], @scheme[#f]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user