[racket] could somebody tell me how this code works?
See
http://www.ccs.neu.edu/home/matthias/HtDP2e/htdp2e-part1.html#(part._.D.K._design-world)
and for something like 'check-with' see
http://docs.racket-lang.org/teachpack/2htdpuniverse.html#(form._((lib._2htdp/universe..rkt)._check-with))
On Oct 5, 2010, at 7:30 AM, 김태윤 wrote:
> hello
> I am a scheme beginner
> I am learning big-bang function with the book, how to design programs
> but I still have no idea how big-bang function exactly work.
>
> #lang racket
> (require 2htdp/image)
> (require 2htdp/universe)
> (define (handle-draw model) (text model 18 "blue"))
> (define (handle-key old-model key) key)
> (big-bang "" ; initial model is empty string
> (check-with string?) ; model is a string
> (on-draw handle-draw 400 50) ; display text in 150x50 pixel window
> (on-key handle-key))
>
> could somebody please tell me how this code exactly work?
> my guessing is this
>
> there is only one checking function.
> if it is true, keep big-bang going.
> if it is false, it stops.
> the first argument of big-bang "" is going to be sent to handle-draw by on-draw
> if key pressed, that handle-draw's return value is going to be sent to handle-key as second argument by on-key
> big-bang's first argument "" is changed to the handle-key's return value.
> and big-bang start again from the beginning with that value as first argument
>
> I still have no idea about the old-model argument.
> is check-with function must be there?
>
> thanks in advanced
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users