zaxis <z_a...@163.com> writes:

>>>value <- readIORef aaa
>>>writeIORef aaa (f value) 

> then aaa will *point to* a new value. 

Exactly.  That's what IORefs are, references pointing to contents that
can be changed in the IO monad.

> The original value will be Garbage Collected, right ?

Yes, unless something else is holding on to it.

> Is [(1,1),(2,2),(3,3)] been regarded as a hash? 

It's a list of pairs.  You can treat it as an association list using
e.g. 'lookup' from Data.List, if that's what you mean.

> If not, what is the best way to change it to [(1,1),(2,2222),(3,3)] in
> function `f` ? 

Not sure if there's anything in Data.List, but you could do something
like: 

  f xs = (2,2222) : filter ((/=2) . fst) xs

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to