|
|
| | Ask HN: Lisp eval vs. Lisp macros. Are they the same underlying concept? | |
1 point by behnamoh 7 minutes ago | hide | past | favorite | discuss
|
| | Is my understanding correct that Lisp's powerful macro system stems from the ability to write the eval function in Lisp itself? From what I gather, Lisp starts with a small set of primitives and special forms—seven in the original Lisp, including lambda. I recall Paul Graham demonstrating in one of his essays that you can build an eval function using just these primitives. Those primitives are typically implemented in a host language like C, but once you have an eval function in Lisp, you can extend it with new rules. The underlying C interpreter only sees the primitives, but as a programmer, you can introduce new syntax rules via eval. This seems like a way to understand macros, where you effectively add new language rules. I know Lisp macros are typically defined using specific keywords like defmacro, but is the core idea similar—extending the language by building on the eval function with new rules? | | | |
|

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact |