POV-Ray : Newsgroups : povray.off-topic : And today, C# Server Time
14 Nov 2024 18:29:47 EST (-0500)
  And today, C# (Message 43 to 52 of 82)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Invisible
Subject: Re: And today, C#
Date: 13 Feb 2008 06:15:35
Message: <47b2d157$1@news.povray.org>
>>>> Me, I dislike anything that says "Lisp" in it. :-S
>>>   Says the person who is infatuated with functional languages such as
>>> Haskell...
> 
>> Aren't you that guy who loves C++ but hates C? ;-)
> 
>   C isn't object-oriented.

True. But C and C++ are vastly more closely related than Haskell and Lisp.

[And if you wanted to split hairs, Haskell is a pure-functional 
language, while Lisp isn't.]

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 13 Feb 2008 06:17:15
Message: <47b2d1bb@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> [And if you wanted to split hairs, Haskell is a pure-functional 
> language, while Lisp isn't.]

  A pure-functional language which has things like indexable arrays and
assignment? Hardly.

-- 
                                                          - Warp


Post a reply to this message

From: Invisible
Subject: Re: And today, C#
Date: 13 Feb 2008 06:20:45
Message: <47b2d28d@news.povray.org>
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>> [And if you wanted to split hairs, Haskell is a pure-functional 
>> language, while Lisp isn't.]
> 
>   A pure-functional language which has things like indexable arrays and
> assignment? Hardly.

Really? And indexable arrays are impure because...?

Similarly, all side-effecting operations are implemented using 
referentially-transparent monadic constructs. In Lisp, if you want a 
side-effect, you just do it. That's the difference.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 13 Feb 2008 07:09:19
Message: <47b2ddef@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> Warp wrote:
> > Invisible <voi### [at] devnull> wrote:
> >> [And if you wanted to split hairs, Haskell is a pure-functional 
> >> language, while Lisp isn't.]
> > 
> >   A pure-functional language which has things like indexable arrays and
> > assignment? Hardly.

> Really? And indexable arrays are impure because...?

  Because it's not a feature of the functional programming paradigm,
but the imperative programming paradigm.

  Purely functional languages are mostly impractical.

-- 
                                                          - Warp


Post a reply to this message

From: Invisible
Subject: Re: And today, C#
Date: 13 Feb 2008 07:11:47
Message: <47b2de83$1@news.povray.org>
Warp wrote:

>> Really? And indexable arrays are impure because...?
> 
>   Because it's not a feature of the functional programming paradigm,
> but the imperative programming paradigm.
> 
>   Purely functional languages are mostly impractical.

Tell me Warp, do you actually understand what "functional programming" 
means?

You seem to think it means "programming with lists", which isn't correct.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 13 Feb 2008 08:47:36
Message: <47b2f4f7@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> Tell me Warp, do you actually understand what "functional programming" 
> means?

  A purely functional programming language doesn't have side-effects.
If I'm not mistaken, for example assignment produces a side-effect.
Even I/O causes side-effects.

  Thus a purely functional language is mostly impractical. Quoting
wikipedia:

"Purely functional programs have no side effects. This makes it easier
to reason about their behavior. However, almost no programmers bother
to write purely functional programs, since, by definition, a program
with no side effects (one that accepts no input, produces no output,
and interfaces with no external devices ) is formally equivalent to a
program that does nothing; typically, purity is used to enforce a
separation of concerns where one clearly-delineated section of the
program does impure operations like I/O, and calls pure functions and
libraries as needed to compute answers."

-- 
                                                          - Warp


Post a reply to this message

From: nemesis
Subject: Re: And today, C#
Date: 13 Feb 2008 08:58:15
Message: <47b2f777$1@news.povray.org>
Warp wrote:
>   Thus a purely functional language is mostly impractical. Quoting
> wikipedia:
> 
> "Purely functional programs have no side effects. This makes it easier
> to reason about their behavior. However, almost no programmers bother
> to write purely functional programs, since, by definition, a program
> with no side effects (one that accepts no input, produces no output,
> and interfaces with no external devices ) is formally equivalent to a
> program that does nothing;

Quoting wikipedia is not always that useful:  that section is most 
likely vandalism by some angry COBOL programmer.

Surely separation of concerns is good as is reducing side-effects to a 
minimum.  To say a purely functional program is incapable of accepting 
input or generating output is not correct:  if anything, a purely 
functional program is able to, in shared memory, take a list as input 
and generate a list as output.  An outside program can write the input 
list in memory, call the pure program on it and read its output and 
write to file.  That's, AFAIK, is what was done in the old days of 
Haskell:  delayed list IO.

More practically, functional language compilers and runtimes carry out 
the ugly side-effect bits while the purely functional programs do their 
stuff and get written as if acting on purely side-effect free 
datastructures.  That's monadic IO today.


Post a reply to this message

From: Invisible
Subject: Re: And today, C#
Date: 13 Feb 2008 09:08:17
Message: <47b2f9d1$1@news.povray.org>
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>> Tell me Warp, do you actually understand what "functional programming" 
>> means?
> 
>   A purely functional programming language doesn't have side-effects.

Indeed.

> If I'm not mistaken, for example assignment produces a side-effect.
> Even I/O causes side-effects.

Assignment and I/O are both side-effects. Accessing an indexed array 
does not. There is absolutely no reason why a pure functional language 
cannot have arrays.

>   Thus a purely functional language is mostly impractical.

Depends on your definition of "practical".

> Quoting wikipedia:
> 
> "Purely functional programs have no side effects. This makes it easier
> to reason about their behavior. However, almost no programmers bother
> to write purely functional programs, since, by definition, a program
> with no side effects is formally equivalent to a program that
> does nothing."

Indeed, a program with absolutely no side effects at all is rather 
pointless. (!) There are several approaches to this apparent problem.

One approach is to *allow* side-effects, but say "hey, don't use this 
unless you have to". This is the Lisp approach. (And Erlang. And a few 
others.)

The Haskell approach is different. A Haskell "program" just returns a 
list of instructions to the Haskell runtime, and the Haskell runtime 
actually "does" the instructions on the program's behalf.

Why is that different? Well, it means that the entire program remains 
referentially transparent. And *that* is the defining characteristic of 
functional programs.

In Haskell, *every* expression can be replaced by the value it returns 
without altering the result of the program. [Indeed, this is notionally 
how you execute a Haskell program.] The same statement does *not* apply 
to Lisp. Hence, Haskell is pure, and Lisp is not. QED.

Note that you *could* write referentially transparent code in just about 
any programming language, if you wanted to. It's just that in Haskell 
you can't write code that isn't. ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 13 Feb 2008 09:24:06
Message: <47b2fd86@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> > If I'm not mistaken, for example assignment produces a side-effect.
> > Even I/O causes side-effects.

> Assignment and I/O are both side-effects. Accessing an indexed array 
> does not. There is absolutely no reason why a pure functional language 
> cannot have arrays.

  Are you telling me in Haskell you can't modify the contents of an array
in-place? (By "indexable array" I implied that it can be assigned to,
although I should have perhaps stated it more explicitly.)

-- 
                                                          - Warp


Post a reply to this message

From: Invisible
Subject: Re: And today, C#
Date: 13 Feb 2008 09:35:53
Message: <47b30049$1@news.povray.org>
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>>> If I'm not mistaken, for example assignment produces a side-effect.
>>> Even I/O causes side-effects.
> 
>> Assignment and I/O are both side-effects. Accessing an indexed array 
>> does not. There is absolutely no reason why a pure functional language 
>> cannot have arrays.
> 
>   Are you telling me in Haskell you can't modify the contents of an array
> in-place? (By "indexable array" I implied that it can be assigned to,
> although I should have perhaps stated it more explicitly.)

Haskell provides a kind of array that you cannot modify in-place. (It's 
useful e.g. for pre-computed lookup tables.)

Haskell also provides another kind of array which can be modified 
in-place in the same sense that files can be written to - i.e., your 
program returns a set of instructions to the runtime that says "hey, 
create this array and modify its contents like this". Which makes sense 
really. After all, what is a "file"? It's a named array of bytes that 
can be modified [and reised] in-place! :-D

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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