3 ms·
This interesting method also brings some interesting bugs. On the last example (find max element in array) the following solution was generated: function r
by thomasikzelf 6y ago
This interesting method also brings some interesting bugs. On the last example (find max element in array) the following solution was generated:
function run(input) {
let output = []
for (let i0 in input) {
// block
let n2 = input[i0];
let n1 = n2 - i0;
if(n1 > i0) {
// block
output[0] = n2;
}
}
return output
}
console.log(run([4,3,8,2,5,1]))
console.log(run([1,1,1,1,1,20,0,0]))
// my counter example:
console.log(run([10, 9]))
It seems you still need to inspect the program to check if the program actually does what you expect it to do. This seems much harder to do with the generated code in the article.
- coolvision 6y agoyes, it's a common problem with inductive approach, can be resolver with adding more exammples.