I'm reading about LISP.
I understand how prefix notation works at a certain level, but I was wondering if there are any tricks to making it intuitive.
I'm reading about LISP.
I understand how prefix notation works at a certain level, but I was wondering if there are any tricks to making it intuitive.
Tricks? What for?
It doesn't feel intuitive for you yet because your mental parser isn't used to it. It'll become better if you just use it and read it over and over again.
Mentally reading it left to right as spoken language with the proper verbs can help. For example (+ 3 2) could be "add three and two". In the more general case, you can say "perform $operation on $operands". Applied to the same case: "Perform the add operation on three and two".
You could think about it as a kind of function call:
(operator operand1 operand2 ...)
There is nothing very special about it. If you overload operators in C++ (and many other languages that allow it) you often have to define this kind of function exactly that way:
MyClass operator+(MyClass const& x, MyClass const& y);
Many languages use a mix of prefix, infix and even postfix.
Lisp just uses only prefix - by default. If sin(x) is intuitive from mathematics, then (sin x) is not far away. If move(dog,home) is a traditional procedure call, then in Lisp it is just (move dog home).
Lisp does not make any exception for mathematics and treats +, -, * and others like ordinary function calls.
When (eventually) "Everything is a function call" (or a special form, or a macro-expansion, both having the surface syntax of "function call") clicked, it felt pretty natural.
So, for (= 1 2)
I read that as 'call the numeric equals comparison on 1 and 2'.