POV-Ray : Newsgroups : povray.off-topic : Ocaml Server Time
4 Sep 2024 15:21:50 EDT (-0400)
  Ocaml (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Kevin Wampler
Subject: Re: Ocaml
Date: 5 Feb 2010 17:27:56
Message: <4b6c9b6c$1@news.povray.org>
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

From: Darren New
Subject: Re: Ocaml
Date: 5 Feb 2010 21:18:28
Message: <4b6cd174@news.povray.org>
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

From: Kevin Wampler
Subject: Re: Ocaml
Date: 5 Feb 2010 22:36:43
Message: <4b6ce3cb$1@news.povray.org>
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

From: Darren New
Subject: Re: Ocaml
Date: 5 Feb 2010 22:44:51
Message: <4b6ce5b3$1@news.povray.org>
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

From: Orchid XP v8
Subject: Re: Ocaml
Date: 6 Feb 2010 03:32:42
Message: <4b6d292a@news.povray.org>
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

From: Orchid XP v8
Subject: Re: Ocaml
Date: 6 Feb 2010 03:34:48
Message: <4b6d29a8$1@news.povray.org>
>>> 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

From: Darren New
Subject: Re: Ocaml
Date: 6 Feb 2010 11:13:08
Message: <4b6d9514@news.povray.org>
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

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.