Hey guys I want to be able to replace a tuple in a list of tuples. Here is what I am thinking:
let lst = [("john",3), ("greg",3), ("tom",2), ("rob",7), ("jason",4), ("tev",7)]
I want to be able to drop any tuple, say (“rob”,7) from the list and then replace it with a new tuple (“ain”,3).
In the end my final list will look something like this:
lst = [("john",3), ("greg",3), ("tom",2), ("ain",3), ("jason",4), ("tev",7)]
Thanks for you help in advance.
It can’t be done. Haskell is a pure functional language, so once a variable has a value, it keeps that value for good.
However, you can easily compute a new list from the old