Your parentheses are likely not in the places where you want them to be. Your call to the function filter has only one argument, the function. data is not a parameter to filter at all. Instead it is the last expression in the body of the let expression, and so it is returned as the value of the let.
You will likely hear suggestions for many things that can be set up in an editor or IDE, but I would highly recommend that even if you don’t go all the way to things like parinfer or paredit, at least having an editor that you configure for showing the parenthesis, square bracket, or curly bracket that ‘matches’ the one that the cursor is on and/or next to, is very, very handy.