Topic: Such here the task

There is arbitrary a lambda-expression. About it a lambda-expression it is known that in it there can be function invocations F (x). And calls can meet some times, and there can be calls the same arguments. About function F (x) it is known that it works "slowly enough" if to cause it with the same arguments will always return identical result. The task: to make optimization initial a lambda-expression, that is to get rid of identical function invocations F (x). An example. On an input expression: (int x, int y) => F (x)> F (y)? F (x): (F (x) <F (2*y)? F (2*y): F (y)) On an output: the Lambda-expression which do preliminary calculation of parameters: var p1 = (int x) => F (x); var p2 = (int y) => F (y); var p3 = (int y) => F (2*y); and the optimized expression: (p1, p2, p3) => p1> p2? p1: (p1 <p3? p3: p2) It is required to create function of the optimized expression evaluation of a type: OptimizedCalculation (lambda, lambdaParams, functionF) {var optimized = OptimizeLambda (lambda, functionF); var result = CalculateLambda (optimized, lambdaParams); return result;} That is at first optimization, then calculation is fulfilled. I ask to consider that initial the lambda-expression can have absolutely arbitrary form. As function F can have absolutely arbitrary appearance and a dial-up of parameters.


Re: Such here the task

Hello, Kaifa, you wrote: On  a distance test problem? Better  in . The forum on , to more people sees.