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

Reply via email to