>>replace k v xs = (k,v) : filter ((/=v) . fst) xs Great ! thanks you very much
minh thu wrote: > > 2009/10/22 zaxis <z_a...@163.com>: >> >>>>f xs = (2,2222) : filter ((/=2) . fst) xs >> It works but not general as `f` still needs to change other value >> according >> to the "KEY". >> Maybe Data.List will supply what i need. > > I don't think Data.List has what you want as-is. The above code is > generalized simply: > replace k v xs = (k,v) : filter ((/=v) . fst) xs > > Cheers, > Thu > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- View this message in context: http://www.nabble.com/How-can-i-safely-change-the-value-of-specified-key---tp26005244p26007076.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe