David Vázquez

24 January 2013

Special arguments

  • lisp

I have learnt a new trick these days. Did you know that you can declare an argument as a special variable? Quoting Hyperspec:

Each required parameter is specified by a parameter variable var. var is bound as a lexical variable unless it is declared special.

It seems to work also for optional and keyword arguments, but Hyperspec does not mention it explicitly. For example, yo can do:

(defvar *variable*)
(defun foo () *variable*)
(defun foobar (&optional *variable*)

comments powered by Disqus

Copyright © 2013 David Vázquez
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
  Commons License