[racket] Sweet expressions; or making it easier to introduce Racket to me and my coworkers :-)
In this regard, I was you a couple years ago.
Spoiler alert: It turned out to be no hurdle at all. The psychic
whiplash lasted days/weeks, not weeks/months.
As people will point out, you must use an editor that does Lisp/Scheme
paren matching and indentation (like DrRacket or emacs).
> ... getting my head to read the deeper
> nested (if (some thing) (else branch)) structures is somewhat painfull.
Actually, "control flow" code like that is pretty easy with the right
editor: The "if", "else" and indentation will be in much the same
places you're used to. The underbrush will just be () instead of {}.
With time you may find yourself doing far fewer nested conditionals
and loops, at all. Because you're using more-succinct tools like
match, map, fold, etc.
Anyway I think you'll probably find it less daunting than you imagine.
Where prefix never gets natural (at least it still hasn't for me) is
complicated math expressions. Having something like curly infix for
that, would be handy.
Also I've been known write some comparisons in infix using a Racket "trick".
Instead of:
(if (< a b) ...
you can write:
(if (a . < . b) ...
Anything between two dots like that "gets moved to the front". This
used e.g. with Racket contracts, so you can write (arg1 arg2 . -> .
result) which is more intuitive than (-> arg1 arg2 result). This can
help in a few cases but isn't the generalized curly infix thing.
On Sun, Jul 17, 2011 at 1:13 PM, Danny Wilson <danny at decube.net> wrote:
> Hi List,
>
> Short version: is there an implementation of
> http://www.dwheeler.com/readable/sweet-expressions.html for typed/racket or
> just racket?
>
>
> Long version:
>
> The past few days I've gotten really excited about the possibilities of
> using the Racket for my projects. I'm mostly a self-taught programmer
> without a CS or scheme background. Currently I'm working on a rather large
> (web)application project, consisting of: haXe, some Scala, PHP
> (unfortunately) a bit of D and modifications to C/C++
>
> I tend to make enough typo's in my coding to appreciate static typing.
> Having tried scheme and lisp now and then, I couldn't really get over
> everything being dynamically typed - (as well not finding any mentioning or
> guarantees about performance, memory usage or anything like that). Typed
> Racket got me very excited.
>
> I 'get' the lovelyness of code as data, as i've written a few code
> generators to reduce boilerplate. But getting my head to read the deeper
> nested (if (some thing) (else branch)) structures is somewhat painfull.
> Especially for my colleagues who never have tried programming in any lisp
> or even heard of it.
>
> I noticed the Holu language, but couldn't find any examples of what it might
> look like. Can languages like holy and typed/racket be combined somehow?
> Again I've just started using DrRacket so maybe these are all very obvious
> questions.
>
>
> Thanks!
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>