[CM] optional arguments in Scheme

Bill Schottstaedt bil at ccrma.Stanford.EDU
Thu May 9 04:18:19 PDT 2013


(Just as I was about to press "send", Rick's answer arrived,
but I'll send my redundant verbiage anyway).

In s7, define* arguments are optional and have keyword names
without any marker like &optkey (:optional is accepted, but ignored).
I'm not sure where &optkey comes from, perhaps def-optkey-fun
in the Common Lisp version of clm?

(define* (hiho a (b 0) (c 0)) (+ a b c))

has 3 optional/keyword arguments.

(hiho 1) -> 1
(hiho 1 11) -> 12
(hiho :c 0 :b 11 :a 1) -> 12

See s7.html under define* (the third major section of the doc).
s7.html has tons of examples, and there are many more in the
Snd *.scm files.  The s7 version of clm is primarily
documented in sndclm.html.




More information about the Cmdist mailing list