News for hackers. Stuff that matters.
Re:We need to talk about parentheses by bloopernova on Monday February 12, 2024 @01:15PM (#39348274)
Aren't there 11 parentheses in both of your code snippets? I must be missing something, sorry could you possibly explain where the missing parenthesis should be?
Re:We need to talk about parentheses by taeric on Monday February 12, 2024 @01:29PM (#39348460)
It helps to basically vocalize what the code is doing. It is a "let" form, which has a list of variables, and then a body section using them. (It is a "let*", which also means that the variables can refer to variables that come before them, but not too relevant here.)

To that end, the first () in a "let" should be of the forms (name value), where value can be a longer form, if needed.

To that end, the last (name value) in the list should almost always look like (name value)), as it is closing the first in the list, that is ((name value).

Re:We need to talk about parentheses by phoe-krk on Monday February 12, 2024 @01:49PM (#39348695)

    (let* ((foo 10)
           (bar (+ foo 32)))
      (* foo bar))
Or, to demonstrate the ugly "nailclip" style:

    (let* ((foo 10)
           (bar (+ foo 32)))
      (* foo bar)
      )
Note that I moved a closing paren off the third line and onto the second one, to close the variable bindings in the LET* form.
Re:We need to talk about parentheses by bloopernova on Monday February 12, 2024 @01:54PM (#39348750)
That explains it, thank you!
Re:We need to talk about parentheses by lelandbatey on Monday February 12, 2024 @01:44PM (#39348643)
They're not saying that the second snippet is "fixed", they're saying that the auto-indented second snippet highlights the mistake to the reader. Yes there are 11 parentheses in both the code snippets because both are "incorrect" in that they're both missing a parenthesis. The GP is trying to point out that since Emacs automatically re-indents the first snippet so that it looks like the second snippet, the reader knows immediately that something "isn't quite right".
Re:We need to talk about parentheses by bloopernova on Monday February 12, 2024 @01:52PM (#39348737)
Ahhh, understood. Thank you!