Thank you very much. That clears everything right up.
-Hillary

On Wed, Jun 13, 2012 at 4:11 PM, Stephen Bloch <bl...@adelphi.edu> wrote:

>
> On Jun 13, 2012, at 3:16 PM, Hillary Ryan wrote:
>
> > Why does this work?
> > (define canvas (new canvas% [parent window] [paint-callback (lambda
> (canvas dc) (draw canvas dc))]))
> >
> > But this doesn't
> > (define canvas (new canvas% [parent window] [paint-callback  (draw
> canvas dc)]))
> >
> > It seems that in both cases the paint-callback is being set to a 2-arity
> procedure.
>
> No, "(draw canvas dc)" is the RESULT of a 2-arity procedure.  "draw" (no
> parentheses, no arguments) would be a 2-arity procedure, equivalent to
> "(lambda (canvas dc) (draw canvas dc))".
>
> > However, in the second case the window doesn't update unless draw is
> called from REPL.
>
> Yes, that's because you're only calling draw once, at the time you define
> canvas.
>
>
>
> Stephen Bloch
> sbl...@adelphi.edu
>
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to