I want to use a list of tuples within a function to make assignments.
Say I want to make assignments of the form
value[i,j] = val
What I have is a list of tuples that give the relevant indices (i,j):
tuples = {{i[1],j[1]},{i[1],j[2]}, ... , {i[imax],j[jmax]}}
What I have found is that this statement will work in Mathematica 8 :
Function[t, value[t[[1]], t[[2]]] = 0.] /@ tuples
But using slots does somehow not work:
value[#[[1]],#[[2]]] = 0. & /@ tuples
... gives an error.
Where is the mistake I am making or is there no way to do this using slots? (using Part[#,1]
and Part[#,2]
will not help either]?