[Haskell-cafe] How can i safely change the value of specified
z_axis at 163.com
Thu Oct 22 05:38:43 EDT 2009
>>replace k v xs = (k,v) : filter ((/=v) . fst) xs
Great ! thanks you very much
minh thu wrote:
> 2009/10/22 zaxis <z_axis at 163.com>:
>>>>f xs = (2,2222) : filter ((/=2) . fst) xs
>> It works but not general as `f` still needs to change other value
>> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
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.
More information about the Haskell-Cafe