The "y" in your program is the default value of the optional argument 'x'. Does this help clarify?
Robby On Mon, Jun 23, 2014 at 8:21 AM, Joshua TAYLOR <joshuaaa...@gmail.com> wrote: > I was answering this Stack Overflow question [1], and came across this > bizarre (to me, anyhow) behavior (REPL transcript from Dr.Racket) > > > Welcome to DrRacket, version 5.3 [3m]. > Language: racket; memory limit: 128 MB. >> (define y 2) >> (define (f (x y)) > (print x) > (print y)) >> (f 1) > 12 > > > Is this expected? If y isn't defined previously, then the definition > is accepted in the REPL, but trying to call (f 1) results in an error: > > > Welcome to DrRacket, version 5.3 [3m]. > Language: racket; memory limit: 128 MB. >> (define (f (x y)) > (print x) > (print y)) >> (f 1) > 1. . y: undefined; > cannot reference an identifier before its definition > > > Putting the definition in the definitions pane and Ctrl-R / Racket>Run > gives an error: > > > (X). y: unbound identifier in module in: y > > > What's going on here? The definition doesn't seem to be a legal form > based on the syntax given in the documentation, but the system's still > accepting it, and with varying behaviors. > > //JT > > > [1] http://stackoverflow.com/q/24365591/1281433 > > -- > Joshua Taylor, http://www.cs.rpi.edu/~tayloj/ > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users