I'm trying to wrap an expression into a lambda and notice that the dummy 
variable of the lambda doesn't match with the variable of the expression. 
Am I doing this right?

Here, the lambda's i is not the same as the i in the expression I send:
>>> def f(fi):
...  return lambda i: fi
...
>>> f(i+1)(1)
i + 1

Here I remap the expression's i to the lambda's i
>>> def f(fi):
...  return lambda i: fi.subs(fi.free_symbols.pop(), i)
...
>>> f(i+1)(1)
2

/c

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/GdT_8xFkBDUJ.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to