[plt-scheme] Fun with paren-shape

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Jun 7 17:23:48 EDT 2007

On Jun  7, Jens Axel Søgaard wrote:
> Eli Barzilay skrev:
> > On Jun  6, Jens Axel Søgaard wrote:
> >> But - we can have both. The version below uses .. for "short"
> >> intervals and "..." for "long" intervals. That is:
> >>
> >>    [1 .. 4]   => '(1 2 3)
> >>    [1 ... 4]  => '(1 2 3 4)
> > 
> > This sounds like a classic bit that is impossible to remember without
> > an open manual.
> 
> Well, It doesn't take long try them in the REPL. But you have
> a point.

Right -- you can say that on anything...  The REPL is great (which is
why I'm on the side of keeping it despite the problems), but at some
point the syntax becomes too arbitrary to deal with (sanely).


> >>> What you've got above is more like [a .. b).  (I'm
> >>> pretty partial to (iota 10 1) for this particular idiom, myself,
> >>> though.)
> >> Iota! Excellent idea. One could argue that (iota 5) is better
> >> syntax than the below, but we can always remove it. I added
> >> the following syntax
> >>
> >>    [5]      =>  (iota 5)     =>  (0 1 2 3 4)
> >>    [5 3]    =>  (iota 5 3)   =>  (3 4 5 6 7)
> >>    [5 3 2]  =>  (iota 5 3 2) =>  (3 5 7 9 11)
> > 
> > (Ugh...)
> 
> Yeah - that's got to go.

Though I like such hacks (too much for most people, I think), the
biggest problem is that your package grabs the [#%app ...] form for
several unrelated things -- it's cute, but doesn't compose well (for
example, arc grabs `[]'s too for quick closures).  I think that this
is the main problem that dooms these things to be cute private-use
hacks.  (And of course, modules+syntax+#%app is (IMO) such a great
thing that makes it possible to use them in your own code...  I can
imagine the horror of trying to do any of this in something like Cl or
R5RS+defmacro...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.