Updating List Elements, Haskell
Posted
by Tom
on Stack Overflow
See other posts from Stack Overflow
or by Tom
Published on 2010-05-15T01:54:05Z
Indexed on
2010/05/15
2:04 UTC
Read the original article
Hit count: 379
I have homework where I am to update a list using a function that takes two elements and returns a value of part of the first element given in the function. So it's required to update the entire listing by going through each element and update its value by applying the function against all other elements in the list (including itself).
So far I've been trying to firstly map the list (so that each element is done the same) and then specifically update each elements value by mapping again just the value of the specified element however in trying to map just the specific value through: the function, the specific element and the entire list I keep getting complaints that I'm inferring the list of values made from the 'map function p@list list' rather than simply giving the value at p@list.
Is this the correct method to try to update a list against the entire list itself?
EDIT: spelling mistakes and grammar
© Stack Overflow or respective owner