[racket-dev] Proposal for a "no-argument"
On 07/01/2012 09:27 AM, Eli Barzilay wrote:
> There rare cases where it is useful to have a value that means that no
> argument was passed to a function. In many of these cases there is a
> plain value that is used as that mark, with the most idiomatic one
> being #f, but sometimes others are used. IMO, while such uses of #f
> are idiomatic, they're a hack where an argument's domain is extended
> only to mark "no argument".
I believe this is why CL lambda lists allow another variable name when
specifying optional parameters.
http://www.lispworks.com/documentation/HyperSpec/Body/03_dab.htm
http://www.gigamonkeys.com/book/functions.html
(defun f (&optional (arg 'default-value arg-supplied?))
(if arg-supplied?
'real-value
'default-value))
Matlab's nargin and nargout are another interesting approach.
http://www.mathworks.com/help/techdoc/ref/nargin.html
http://www.mathworks.com/help/techdoc/ref/nargout.html
A (supplied? arg) special form might also work.
- Daniel