![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible wrote:
> integer * string
> which seems a rather perverse choice.
Cartesian product of integers and strings. I'm not sure what a "sum type"
would be.
> instead of "(True, 5)"? It would be clearer...)
Wait till you get to python, where the tuple constructor is actually the
comma, the parens are optional, and you try to figure out how to write a
one-element tuple literal, or the empty tuple.
> Haskell makes the rather illogical choice of using "--" as the start
> marker for a comment.
Common in a lot of other languages like SQL and Ada. FWIW.
> Ocaml uses the even stranger choice of "(* ... *)".
Which is Pascal for comments, if your keyboard (punched cards) don't have
curly braces. FWIW.
--
Darren New, San Diego CA, USA (PST)
Forget "focus follows mouse." When do
I get "focus follows gaze"?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> integer * string
>> which seems a rather perverse choice.
>
> Cartesian product of integers and strings. I'm not sure what a "sum
> type" would be.
Either Int String
is a sum type. The set of possible values is the *sum of* the set of
possible Int values and the set of possible String values.
Whereas... well, you understand what a Cartesian product is already, right?
Haskell's "algebraic data types" are sum types of product types. (The
sum may contain only one summand, but a sum none the less. Actually, if
you enable the EmptyDataDecls extension, zero summands are permissible...)
>> instead of "(True, 5)"? It would be clearer...)
>
> Wait till you get to python, where the tuple constructor is actually the
> comma, the parens are optional, and you try to figure out how to write a
> one-element tuple literal, or the empty tuple.
Oh, the *type constructor* for a 2-tuple is "(,)", and for a 3-tuple
it's "(,,)".
So if you want to be 73% anal, you can write "(,) String Integer"
instead of "(String,Integer)". :-}
Off the top of my head, I don't *believe* this works with value
constructors... No, wait. I'm wrong; it does work.
(,,) :: a -> b -> c -> (a,b,c)
This means we can write
zip = zipWith (,)
Eat THAT and smoke it! o_O
(Similarly, "[Char]" can also be written "[] Char".)
>> Haskell makes the rather illogical choice of using "--" as the start
>> marker for a comment.
>
> Common in a lot of other languages like SQL and Ada. FWIW.
I know Eiffel uses it. But then, Eiffel is weird.
>> Ocaml uses the even stranger choice of "(* ... *)".
>
> Which is Pascal for comments, if your keyboard (punched cards) don't
> have curly braces. FWIW.
...more useless information to add to my collection! o_O
Then again, in Pascal "(*)" is not a meaningful thing to write in the
first place. ;-)
PS. I'm loving the way Haskell uses curly brackets for explicit
grouping, AND ALSO for named-field syntax. Way to use the exact same
symbol for two unrelated things that you might want to do AT THE SAME TIME!
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Orchid XP v8 wrote:
> Either Int String
Obvious once stated.
> Oh, the *type constructor* for a 2-tuple is "(,)", and for a 3-tuple
> it's "(,,)".
Not in Python. The cosntructor for a 2-tuple is ,
No parens needed. Figure *that* one out. :-)
>> Common in a lot of other languages like SQL and Ada. FWIW.
> I know Eiffel uses it. But then, Eiffel is weird.
That too. All the "readable" languages tend to use it, because it's how you
offset comments in English -- that is, if you have a comment to make.
--
Darren New, San Diego CA, USA (PST)
Forget "focus follows mouse." When do
I get "focus follows gaze"?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New wrote:
> Not in Python. The cosntructor for a 2-tuple is ,
> No parens needed. Figure *that* one out. :-)
This isn't *quite* correct, since a single comma can construct either a
1-tuple or a 2-tuple depending on how it's used:
"foo", --> 1-tuple
"foo",bar --> 2-tuple
It's probably best to view the tuple constructor as a comma, which can
be used as a binary operator or as a unary postfix operator (ignoring
3-n-tuples of course).
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Kevin Wampler wrote:
> This isn't *quite* correct, since a single comma can construct either a
> 1-tuple or a 2-tuple depending on how it's used:
Right. That's the weirdness of it, including the fact that there are other
uses for the comma (like between function arguments) as well.
--
Darren New, San Diego CA, USA (PST)
Forget "focus follows mouse." When do
I get "focus follows gaze"?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New wrote:
> Kevin Wampler wrote:
>> This isn't *quite* correct, since a single comma can construct either
>> a 1-tuple or a 2-tuple depending on how it's used:
>
> Right. That's the weirdness of it, including the fact that there are
> other uses for the comma (like between function arguments) as well.
This seems to be (for better or worse) sort of the python philosophy of
language design, and as far as I can tell they at least seem to be
consistent about when they are inconsistent. It reminds me of how they
parse expressions with comparison operators specially so you can type
"if a < b < c:" and have it work. It's simple to understand on a
"human" level, but it's definitely a special case in how the syntax is
parsed.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Kevin Wampler wrote:
> "if a < b < c:" and have it work.
Yeah. I really don't understand why more languages don't support this sort
of thing. I mean, even COBOL got *that* right. :-)
> It's simple to understand on a
> "human" level, but it's definitely a special case in how the syntax is
> parsed.
Yeah, it's just weird to see an expression like
x = y,
--
Darren New, San Diego CA, USA (PST)
Forget "focus follows mouse." When do
I get "focus follows gaze"?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New wrote:
> Kevin Wampler wrote:
>> "if a < b < c:" and have it work.
>
> Yeah. I really don't understand why more languages don't support this
> sort of thing. I mean, even COBOL got *that* right. :-)
BUUUURN!
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>>> Common in a lot of other languages like SQL and Ada. FWIW.
>> I know Eiffel uses it. But then, Eiffel is weird.
>
> That too. All the "readable" languages tend to use it, because it's how
> you offset comments in English -- that is, if you have a comment to make.
TeX uses "--" to mean an N-dash, and "---" to mean an M-dash [which is
the kind that ought to be used for seperating a comment].
Haskell being what it is, you can *probably* activate Unicode mode and
use the actual Unicode character for an M-dash.
(I don't know if you know this, but Haskell can actually be written with
Unicode symbols like arrays and stuff in place of the cheese ASCII-art
everybody always uses...)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Orchid XP v8 wrote:
> (I don't know if you know this, but Haskell can actually be written with
> Unicode symbols like arrays and stuff in place of the cheese ASCII-art
> everybody always uses...)
And I'm pretty sure APL has its own block of characters in unicode as well.
--
Darren New, San Diego CA, USA (PST)
Forget "focus follows mouse." When do
I get "focus follows gaze"?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |