Hello ptrash,

Sunday, June 7, 2009, 9:41:56 PM, you wrote:

> Hi, how can I change the value of a variable.

there are no variables in haskell :)))

x, like any other identifier, is a value. when you translate to Haskell
some algo that needs to update variable contents, you may either

1) use recursion:

length (x:xs) = 1 + length xs
length [] = 0

2) use references (IORef). like in C, references by itself are non-mutable,
but they point to values that can be mutated




-- 
Best regards,
 Bulat                            mailto:bulat.zigans...@gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to