Next: Depend/Support facilities
Up: Rscheme Notes
Previous: Useful commands
Some common lisp facilities are not provided in Rscheme. These include:
- 1.
- Keyword arguments, optional arguments to functions.
- 2.
- Generalized
setf
facility.
- 3.
- Module facilities.
The following example illustrates how functions with variable number of argument can be implemented in Rscheme. Consider the function
(define (foo x . arg)
(if (null? arg) x (+ x (apply + arg)))
)
When calling foo with a variable number of arguments, arg will be instantiated to the list of arguments following the first argument in the the call. For example, in (foo 2 3 2), arg will be the list (3 2), and in (foo 2), arg will be ().
Emilio Remolina
2000-10-04