
Well, the short answer is sort of. The long answer is that you can't
really have variables declared outside of a function definition. When
you do something like:
x = 5
what you're really doing is declaring a new function x that takes no
arguments and returns the constant 5.
On Jul 25, 2009, at 12:25 AM, Duke Normandin
Hello....
I'm 2 days into Haskell. NOT new to Perl, PHP, M(umps), TCL, newLISP. I'm using "YAHT.pdf" as an intro to Haskell. Here's a quote:
[quote] ... if you have a value x, you must not think of x as a register, a memory location or anything else of that nature. x is simply a name, just as Hal is my name. You cannot arbitrarily decide to store a different person in my name any more than you can arbitrarily decide to store a different value in x. This means that code that might look like the following C code is invalid (and has no counterpart) in Haskell:
int x = 5; [/quote]
So is fair to say that an expression in Haskell like:
x = 5
is more like a constant in imperative languages - say Perl? E.g.
use constant SECONDS_PER_DAY => 86400; -- duke _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners