I want to solve the given problem to make reasoning about higher order functions easier for me in the future. Given an array of ones and zeroes, we need to find the elements that are surrounded by ones.
// 0 1 2 3 4 5 6 7 8 9101112
const bombfield = [0,0,1,1,0,0,1,0,1,1,1,0,1];
//The above array has 3 bombs, being 0 1 and 0 at positions 7, 9, and 11.
//What I want to do is filter the array for the bombs, using a function such as this:
const bombs = bombfield.filter((x) => (y) => (z) => (x == 1 && z == 1));
// What I expect this to return through currying is those elements that have 1 as each of their neighbors.