On Jul 21, 2011, at 6:44 AM, Stephen Bloch wrote:
> Right. Nested conditionals and loops in Racket are no more syntactically
> painful than nested conditionals and loops in Java/C/C++, if you put braces
> around the bodies.
> ( if ( > x y ) (+ x 3 ) ( * 4 y ) )
> if ( x > y ) { x = 3 ; } else { y = 4 ; }
You don't have to go non-idiomatic in Racket to approximate
the non-nesting, step-by-step style of C, Java, and such languages.
Now that define is legal in many places, just give names to
intermediate results. More generally, here is a conjecture
about the psychology of programming:
people take to programming in C more easily than
to algebra because they can 'store' intermediate
results in 'registers' and take a break to contemplate
what to do next.
Warning: this is an untested conjecture by a guy who has 0
background in psychology or how to conduct an experiment.
All of this is based on observations.
-- Matthias
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users