🧀 BigCheese.ai

Social

My mental model of setf was wrong

🧀

Simon Dobson discusses his realization that his understanding of the 'setf' macro in Lisp was incorrect. He details how 'setf' accesses the structure of its arguments at compile time, not the values, which led to his mistaken belief that 'setf' worked on a location when in fact it expands into a method call. He explores the implications for Lisp's flexibility through examples and points out the capabilities of macros and generic functions in the language.

  • 'setf' is a macro that accesses arguments' structure.
  • Macro 'setf' dispatches to a method at compile time.
  • New 'setf' forms aren't restricted to 'car' or 'cdr'.
  • 'setf' can be specialized with multiple arguments.
  • 'setf' forms can also be specialized by value type.