Step 49 - Learn Functional Programming by Building a Spreadsheet

I am having trouble updating my elemValue function to the syntax of an implicit function. Please help.

Step 49 - Use the same syntax as your addCharacters function to update your elemValue function. It should no longer declare inner , but should return the function implicitly.

const evalFormula = (x, cells) => {
  const idToText = id => cells.find(cell => === id).value;
  const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi;
  const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2));
  // const elemValue = num => {
  //   const inner = character => {
  //     return idToText(character + num);
  //   }
  //   return inner;
  // }
//My code attempt -----
  const elemValue = num => character => idToText(character+num) ;
  const addCharacters = character1 => character2 => num => charRange(character1, character2);

Also, how would I return inner at the end if the instructions say to not declare inner? I am also confused about that part.

It worked for me only after resetting the lesson and then fully deleting the commented out version. I’m guessing because both ways do the same thing, the tests have to actually read the code you wrote, saw the regular syntax, didn’t realize it was a comment, and failed the test because it wasn’t implicitly returning, but idk

1 Like

You are still returning the same function that used to be called inner, you just aren’t declaring it as a named function anymore. It’s double implicit return, I guess. It might be confusing just because the instructions said to return inner, maybe they should have said ‘return the function formerly known as inner,’ or something, lol. This part character => idToText(character+num) is inner, and it’s being implicitly returned in num => character => idToText(character+num)

1 Like