public int Visit(BinaryFunc func) { return(Compile(func, () => { var leftIndex = func.Left.Accept(this); var rightIndex = func.Right.Accept(this); var element = new Compiled.BinaryFunc { Eval = func.Eval, Diff = func.Diff, Left = leftIndex, Right = rightIndex, Inputs = new Compiled.InputEdge[] { new Compiled.InputEdge { Index = leftIndex }, new Compiled.InputEdge { Index = rightIndex }, } }; return element; })); }
public TapeElement Visit(BinaryFunc func) { return(Compile(func, () => { var leftElement = func.Left.Accept(this); var rightElement = func.Right.Accept(this); var element = new Compiled.BinaryFunc(func.Eval, func.Diff) { Inputs = MakeInputEdges(() => { edges.Add(new InputEdge { Element = leftElement }); edges.Add(new InputEdge { Element = rightElement }); }) }; return element; })); }