On 06/23/2014 09:21 AM, Joshua TAYLOR wrote: >> (define y 2) >> (define (f (x y)) > (print x) > (print y)) > > Is this expected?
You've stumbled across Racket's syntax for default values for arguments, a.k.a. optional arguments. [1] If I write (define (myproc [x "hello"]) ...) then if I call myproc with one argument, then x takes the value of that argument, and if I call myproc with no arguments, then x takes its default -- "hello". Your function, (define (f [x y]) ...) says "if x is omitted at the call site, then bind x to the value of the variable y for the body of f". Regards, Tony [1] http://docs.racket-lang.org/guide/contracts-general-functions.html?q=optional#%28part._contracts-optional%29 ____________________ Racket Users list: http://lists.racket-lang.org/users