17 Jan 2002
(updated 17 Jan 2002 at 22:18 UTC) »
Why must every language have it's own ideas of what
operators should do what? Yes, some are stupid. But Why
should I have to remember that commas are list
separators except in the case where there are
two of them in a row? And what if I have an empty item in my
Mostly, what's wrong with having "+" or
the cat operator? + makes sense in that you're getting the
sum of two strings. </rant inspiredBy=sej>
I guess this was in response to this diary
entry. As a friend of mine used to say, thanks for
First, I should explain my command
interpreter supports 3 distinct aggregrate data
structures: randomly-indexed lists (or arrays),
sequentially-accessed streams, and attribute-lists (or
dictionaries). There is also a string data type, but it is
a scalar entity as far as this discussion (and yes, "+"
concatenates two strings).
Attribute-lists are accessed with a "." notation. If
is an attribute-list, "abc.xyz" resolves to a name/value
pair (an attribute), where "xyz" is the name, and the value
is arbitrary (if there is no "xyz" attribute in the "abc"
list it resolves to nil). So the "." is taken.
The other two aggregate data types are somewhat
to each other, lists which are traversed by iterating an
index variable, and streams which are traversed until a next
operator returns nil. Streams have an APL-like ability to
overdrive scalar operations. "1,2,3,4" is a list of length
4. "1,,2,,3,,4" is a stream that will return 4 values.
"1,2+3,4" is a stream that will return 2 values, 4 and 6.
The reason for liking ",," as the stream concatenator is
that a long time ago I've employed ".." as the integer
iteration operator ("1..10" is a stream that will generate a
count from 1 to 10), and "**" as the repeat operator
("1**10" is a stream that will generate ten 1's). So the
",," was a natural as the third exclusively stream-based
So the short answer to your mild rant is that different
languages use operators in a different manner because they
are trying to accomplish different things. To quickly
conclude that the choice of operators is idiosyncratic and
frivolous might be a mistake, when the truth might be the
of operators is idiosyncratic but not at all
p.s. streams are nil terminated, but lists/arrays can have