[racket] Sweet expressions; or making it easier to introduce Racket to me and my coworkers :-)

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Jul 21 09:42:51 EDT 2011

This whole "too many parens" thing has nothing to do with the language
and everything to do with the programmer.

I googled "javascript example callback code", took the second hit (the
first hit seemed to go to a page with VB code; go figure) and the
first snipped of javascript code. Guess what it ends with. Did you
guess this:

       console.log(data);
    });
  });
});

? Right on!

(Amusingly, the rest of the blog post seems to be about avoiding the
nesting by giving things names :).

Robby

On Thu, Jul 21, 2011 at 8:25 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> 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
>



Posted on the users mailing list.