
16 Nov
2009
16 Nov
'09
2:06 a.m.
thanks for all your answers ! zaxis wrote:
defineVar :: Env -> (Id, Val) -> IOThrowsError Val defineVar envRef (id, val) = do { env <- liftIO $ readIORef envRef; env <- return $ filter (\(_id, _) -> _id/=id) env; -- clear the current scope valRef <- liftIO $ newIORef val; liftIO $ writeIORef envRef $ ((id, valRef):env); return val; }
In haskell, the variable canot change its value , right? If so, why can the `env` be assigned value twice?
Sincerely!
----- fac n = foldr (*) 1 [1..n] -- View this message in context: http://old.nabble.com/Why-can-%60env%60-be-assigned-value-two-times---tp2635... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.