2

I've read and understood that not all s-exps are necessarily valid forms. In particular, valid list forms must start with a symbol that will be evaluated as being either:

  • a function name
  • a macro name
  • a built-in form

If that's the case, then what happens in the reader and evaluator when I type this:

((lambda (a) (+ 1 a)) 1)
-> 2

The first element of that list is not a symbol, it's a list. So how come it evaluates? Is the reader doing something special here?

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
cerendata
  • 21
  • 1
  • 2
    See hyperspec [3.1.2.1.2 Conses as Forms](http://www.lispworks.com/documentation/HyperSpec/Body/03_abab.htm). – jkiiski Sep 04 '17 at 07:13
  • 1
    It's a macro that gets expanded to `#'(lambda...)` and it is the only exception to the rule since unlike an arbitrary expression every aspect is known at compile time. – Sylwester Sep 04 '17 at 10:48

0 Answers0