Comment by nkwiatek

13 years ago

    /**
     * Auto-generated, do not edit!
     */
    function add(x, y) { 
      /* test 1 */
      if (x == 2 && y == 2) { 
         return 4;
      }
      /* test 2 */
      if (x == 1 && y == -1) { 
         return 0;
      }
    }

Simple. Do some monte carlo comparisons between a large number of generated functions, based on various heuristics like number of instructions. So quickly get rid of explicit mapping of tests, especially if used larger. Add some genetic algorithms and a little more AI stuff ;)

One interesting thing though with auto-generated code based on specific test code is that when the test fails at some point the process just has to be repeated, potentially being done automatically.

  • Why not jump to prolog if you want to want to declare what the properties of the code are and have the compiler figure out how to actually do it?