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

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Thu Jul 21 09:58:14 EDT 2011

It's definitely true that lots of other languages have just as much
punctuation as Racket.  However, for many of these languages, this is
seen as a drawback: witness the popularity of Ruby, or Python, or
CoffeeScript.  Certainly in the JS community, examples like yours are
seen as a problem (for multiple reasons, but partly because of the
excessive punctuation) that people are trying to address.

What your example does show, of course, is that lots of punctuation
isn't always a barrier to success.

On Thu, Jul 21, 2011 at 9:42 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> 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
>>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users



-- 
sam th
samth at ccs.neu.edu



Posted on the users mailing list.