5 ms·
I think there’s a much simpler example of how code is data: (hello world) That’s a list containing two symbols. So it’s data. However, if I evaluate that
by accatyyc 9y ago
I think there’s a much simpler example of how code is data:
(hello world)
That’s a list containing two symbols. So it’s data. However, if I evaluate that list, it will call the function “hello” with the argument “world”. So it’s also code.
Incidentally, lists and function calls are identical in lisp, hence code is data.
I think the article just complicates it by introducing macros.
- rootlocus 9y ago'(hello world) is a list (hello world) is a function call
- Karunamon 9y agoWell, technically they're both lists, it's just that the ' prefix makes it a list literal rather than having the compiler try to macro expand it. A bit pedantic, but of massive importance when macros are in play.
- tincholio 9y agoEvaluate it, not macro expand it ;)
- junke 9y agoTypically when writing about lisp code, it is also correct to talk about how "read" sees the expression, to avoid some confusion about what happens after "eval". That's how I interpret the parent comment when it says that (hello world) is a list of two elements.