To declare a new function use
which has the following form:
This creates a new function named
parameter-names as parameters.
When the function is called, the
are initialized with the actual arguments. Then
is evaluated, and that becomes the result of the call.
For example in the
factorial function we looked at recently,
(define (factorial x) (if (< x 1) 1 (* x (factorial (- x 1)))))
A lambda expression has the following form:
You can declare a function that takes optional argument, or variable number of arguments. You can also use keyword parameters. Read more here.