I have a problem where Table and similar functions' substitution variable name can conflict with names in my function it self. Here's a minimal example
foo[a_] := Probability[x > 0, x \[Distributed] NormalDistribution[a, 1]]
if i execute
I get the correct answer (0.158655).
if I execute instead (or use Table or similar)
foo[x] /. x->-1
I get 0 because the substitution operator substitutes x into the
Probability arguments too making foo become
The obvious "fix" is to just not use the same variable but then I have to remember how i've defined every function I've written and if I forget i risk making a mistake that may or may not be obvious.