Skip to main content
2 of 3
added 31 characters in body
user13253
  • 8.8k
  • 3
  • 44
  • 68

How to avoid nested With[]?

With[ {v1 = #}, With[ {v2 = f[v1]}, g[v1, v2] ] ] 

How to avoid nested With[] like the above? I'd like to use v1 and v2=f[v1] in the module's body. Is using Module[{v1, v2}, v2=f[v1]; g[v1, v2]] the best/only way?

user13253
  • 8.8k
  • 3
  • 44
  • 68