Another idea for making this configurable might be to use eval[]. For example, if you have an expression as a string (which could be a contraption attribute):
expr:"(n-10)/2"
You could then evaluate it under a dictionary of variable bindings:
(x+floor eval[expr ("n" dict grid1.cellvalue)].value) ...