[CM] optional arguments in Scheme

Antoine antoinedaurat at googlemail.com
Thu May 9 00:30:49 PDT 2013


I am having a hard time understanding optional arguments 
in Scheme and could use a little help.
I want to pass optional arguments, without having to write 
the keywords and it seems that in that 
case "&optkey" becomes an argument!...

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

(hiho 1 12)

=> 1

(hiho 1 12 1 1)

=> 3

Neither s7 documentation nor Common Music's reference 
or examples give an overview of the syntax 
for optionals and rests arguments. Could you be kind enough 
to point me the right direction? :)
Thank you!

More information about the Cmdist mailing list