The syntax for local
is:
(local {def ... def} exp)where each
def
is
a define
or define-struct
.
exp
is any expression,
and is called the body of the local.
(Note to labbies: This much suffices; the following is optional.)
Note that DrScheme doesn't care about what type of parentheses you
ever use (as long as they match).
Dr. Wong takes advantage of this by using square-brackets to
set off the list of local definitions.
(Dr. Barland prefers using square-brackets for pairs of things,
like in cond
, and using squirrely-brackets "{
" for
lists of things such as here in local
.)
Either is fine, but do use alternate parentheses to help
make your code easier to read (your indentation, names, and choice
of characters all help reflect your code's structure!)
Nitpick:
The above definition of local
's syntax has a "..."
in it (and misleadingly suggests a local
requires
at least two def
s).
If you really had to specifiy the precise syntax?
(local list-of-def exp)where a
list-of-def
is ...!
You can look in help-desk under "manuals",
find the manual for Intermediate-Student,
and see the official syntax -- not just for
local
,
but for the entire language!