Choking on Syntactic Sugar

Chris Pressey <>
Wed Mar 14 04:28:57 CET 2001

Robert Virding wrote:
> Klacke <> writes:
> >Yeah, if you feel the ++ operator is weird, take a look at the
> >-- operator which is also described in the same doc, it's really
> >weird. Not useless though.
> -- is a joke.

I did laugh the first time I saw it, but I've since found it
unexpectedly convenient!  :-)

> I had planned to do something with ** and // as well but never
> got around to it.  Any suggestions? :-)

** could do lists:duplicate/2 (perhaps with argument order reversed)
akin to Perl's 'x' operator.  e.g: io:fwrite("~s", ["-" ** 72]).

// could do lists:nth/2 (again, perhaps with reversed arguments)
somewhat akin to array-indexing other languages.  e.g: [foo,bar,baz] //

It might be nice if all of these (++, --, **, //) worked the same on

Also, it would be (IMO) very cool to make <- meaningful outside of a
list-comprehension (in a guard and/or expression).  X <- [1,2,3] would
evaluate to true if X == 1 or X == 2 or X == 3.  It would also be great
if this could be expanded at compile-time for constant lists (although I
realize that might get a little hairy.)


"Ten short days ago all I could look forward to was a dead-end job as a
engineer.  Now I have a promising future and make really big Zorkmids."
Chris Pressey, Cat's Eye Technologies,
Esoteric Topics Mailing List:

More information about the erlang-questions mailing list