[racket-dev] P4P: A Syntax Proposal

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Wed Jul 28 18:27:48 EDT 2010

> Infix goes beyond just arithmetic, ruby allows this sort of syntax
> some_list.map{...}.filter{...}.map{...}.fold_right{...}
> Which I find much more readable than
> (fold-right (map (filter (map some_list)))

That has actually been very much on my mind for a while now.  Quoting
from our Flapjax paper (pg 12):


Functions versus Objects

Flapjax encourages making Web applications more functional in
style. This can, however, lead to deeply nested function applications,
which are syntactically alien to many JavaScript developers. We have
therefore found it convenient to make all the standard functions
available as methods in the Behavior and EventStream prototypes. This
means that instead of

  var name = calmE(changes($B("name")), 300);

developers can write

  var name = $B("name").changes().calmE(300);

which is arguably more readable than standard functional notation,
since the left-to-right order of operations corresponds to the
direction of dataflow. We do offer all these operations as standard
functions also, so developers can use whichever style they favor.


What I didn't admit there is that *I* prefer the dotted style for this
kind of sequential pipeline.


Posted on the dev mailing list.