
Hello listers, would one be correct in thinking that 'bound variables' such as those used in haskell were in fact constants? Sincerely Matthew Williams

On 2008 Oct 13, at 2:58, Matthew J. Williams wrote:
Hello listers, would one be correct in thinking that 'bound variables' such as those used in haskell were in fact constants?
Only in certain limited circumstances. Consider the following:
let x = f x in x
This finds the least defined fixed point of f. See < http://en.wikibooks.org/wiki/Haskell/Fix_and_recursion
.
Top level constant applicative forms (that is, bindings without arguments) with monomorphic types can generally be considered to be constants, and the compiler may assume this and inline it. But it's not required to do so. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Matthew J. Williams wrote:
Hello listers, would one be correct in thinking that 'bound variables' such as those used in haskell were in fact constants?
I think I see what you mean, but it is not entirely correct. A constant is something which has the same value at all times. For example, top-level declarations in most languages, including Haskell, can be seen as constants: foo = "hello world" -- this foo will always mean "hello world" If the value associated with a name changes from time to time, then we call that name a variable. bar foo = ... -- foo will mean something else everytime bar is called The behaviour of Haskell variables is similiar to "constant variables" or "final variables" in other languages, e.g. in Java public int bar(final int foo) { } Similiar to the Haskell version, in this Java code, foo will be something different for each call of bar, but it will not change during one execution of bar. Your wouldn't call foo a constant here, would you? Tillmann

Hello listers, would one be correct in thinking that 'bound variables' such as those used in haskell were in fact constants?
I think I see what you mean, but it is not entirely correct. A constant is something which has the same value at all times. For example, top-level declarations in most languages, including Haskell, can be seen as constants:
foo = "hello world" -- this foo will always mean "hello world"
If the value associated with a name changes from time to time, then we call that name a variable.
bar foo = ... -- foo will mean something else everytime bar is called
The behaviour of Haskell variables is similiar to "constant variables" or "final variables" in other languages, e.g. in Java
public int bar(final int foo) { }
Similiar to the Haskell version, in this Java code, foo will be something different for each call of bar, but it will not change during one execution of bar. Your wouldn't call foo a constant here, would you?
My recollection of 'final' in 'Java' is a little vague, nevertheless, in 'c/c++' the const keyword indicates that the associated function argument must be 'treated' as a constant. I am not convinced that the idea of a constant value is not being honored in this situation. The function definition is after all a 'pattern' (if I may be permitted to use the term in its most general sense): int f (const int x) { return (x+1); } would be equivalent to the following: let f x = x+1 In 'c/c++' a global constant would have very similar properties, in fact, exactly similar in so far as the 'immutability' of the value is concerned. Sincerely Matthew J. Williams

On Mon, 13 Oct 2008, Matthew J. Williams wrote:
Hello listers, would one be correct in thinking that 'bound variables' such as those used in haskell were in fact constants?
Possibly the simplest explanation is that they're variables in the same sense variables in algebra are? -- flippa@flippac.org The task of the academic is not to scale great intellectual mountains, but to flatten them.
participants (4)
-
Brandon S. Allbery KF8NH
-
Matthew J. Williams
-
Philippa Cowderoy
-
Tillmann Rendel