You'd create the new world and set field values using mutators. So
if (x > 248 && x < 424 && y > 570 && y < 649) { SState newState = new SState(); newState.setBackground(blah); newState.setButton(blah2); ... } On Sun, Aug 1, 2010 at 5:22 PM, Richard Cleis <rcl...@mac.com> wrote: > [snip] > > I was trying to emphasize that it may be harder to students to keep their > code neater compared to some other languages which usually have code that > rarely exceed 1 line. > Example: > Racket using the universe teachpack: > (define (s-mouse-engine s x y event) > (cond > [(and > (and (> x 248) (< x 424)) > (and (> y 570) (< y 649))) > (make-S-STATE > (get-s-background s) ;;I have made methods here to > reduce length, but other wise it would be longer. > (make-button > (s-mouse-engine-worker1 event "button-img") > (get-s-button-x s) ;;I have made methods here to > reduce length, but other wise it would be longer. > (get-s-button-y s) ;;I have made methods here to > reduce length, but other wise it would be longer. > (s-mouse-engine-worker1 event "button-initiate")))] > > How would you write that in another language that rarely exceeds one line? > rac > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users