Version française
Home     About     Download     Resources     Contact us    
Browse thread
environment idiom
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: William Lovas <wlovas@s...>
Subject: Re: [Caml-list] environment idiom
On Sun, Dec 12, 2004 at 10:56:38AM +1100, skaller wrote:
> The bottom line is that given an environment E
> 
> 	f: A -> B
> 
> is not functional if f fiddles with environment E.
> It is absurd then to think that
> 
> 	f: E * A -> E * B
> 
> is suddenly purely functional, just because the environment
> is now made explicit.  [...]

I'm not sure i buy this: if f returns the same result every time it's
called with the same argument, and calling f cannot affect the behavior of
any other part of your progrem, then in what way is f not purely
functional?

> A final example. Ocaml *is* purely functional. As long
> as you consider references as values -- rather than what
> they refer to. In reality, it's just a state transformer
> monad like Haskell, only the encoding is built in to
> the language.

But there exist "functions" in O'Caml whose behavior is not always the same
for a given argument, namely (!).  Does Haskell have such "functions"?

You're blurring some definitions fairly substantially when you say things
like "Haskell is not purely functional, but O'Caml is" :)

cheers,
William