[IronPython] IP 2: Execute multiple expression in different scopes
Christian Schmidt
christian2.schmidt at gmx.de
Mon Aug 11 13:41:50 CEST 2008
Hi,
I'm trying to figure out the best way to embed IP 2 expressions into C#
to implement the following:
I have given a scope that consists of an IList<object> and a mapping of
the list's indices to a name.
Now I want to evaluate several expressions within this scope.
After this, the scope changes, but the mapping stays the same, only the
IList changes. Then again the expressions are evaluated.
What is the right way to do it?
// Input
IEnumerable<IList<object>> data = ...
IList<string> names = { "a", "b", "c" };
IList<string> pyexpressions = { "a+b", "sqrt(b*c)" };
// expected Output
delegate object MyEval(IList<object> row);
IList<MyEval> expressions;
// IP 2 magic
// ???
// Calculate
foreach(IList<object> row in data)
foreach(MyEval expression in expressions)
object obj = expression(row);
// ...
Thanks,
Christian
More information about the Ironpython-users
mailing list