[Haskell-beginners] haskell variables - or not

dukeofperl at ml1.net dukeofperl at ml1.net
Sat Jul 25 08:32:21 EDT 2009


On Fri, 24 Jul 2009, Duke Normandin wrote:

> 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

Thanks to all the responders!!

--Thomas F.

> You will get the idea in a couple of days.  I am sure.

Maybe next week!  I'm going fly-fishing for trout on the weekend, as is my
usual
practice here in the Alberta (Canada) foothills ;)

-- Kyle M. & Thomas D.

What I gather from your replies is that the only "true" variables in
Haskell are the args passed to a function. Is that correct?

...and further, that what sometimes appears to be a variable to an
"unwashed" imperative programmer", is really a function with no arguments,
returning a "constant" value. How did I do?
-- 
duke


More information about the Beginners mailing list