Scheme/Procedures

From Noisebridge
Revision as of 22:03, 2 April 2011 by Chris-kun (talk | contribs) (Created page with '== Lambdas == * Can also be viewed as anonymous procedures. * Has the following syntax: <pre>(lambda <args> <expressions>)</pre> where <expressions> is one or more, well, express…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Lambdas

  • Can also be viewed as anonymous procedures.
  • Has the following syntax:
(lambda <args> <expressions>)

where <expressions> is one or more, well, expressions. Only the last expression's value is returned.
<args> is your variable definitions, which can take the following forms:

  • var - all arguments are put into this single variable.
  • (var[1] var[2] ... ) - specifies a fixed number of arguments.
  • (var[1] var[2] ... . var[n]) - a space-delimited period before the final argument specifies the remaining args (if any) to be put into a list under that variable.