3 ms·
It's more that code and data have the same representation. For example, where is the Json of Python? Where is the Python object notation which is both how you r
by didibus 7y ago
It's more that code and data have the same representation. For example, where is the Json of Python? Where is the Python object notation which is both how you represent Python Objects in code as well as when serialized to data over a wire?
[1 2 3] is both the serialized form of a vector as well as valid code to create a vector of itself.
Now in JS, only object data is homoiconic. In Lisps, even code expressions are homoiconic, thus (+ 1 2) is the serialized form of the list of function + and args 1 and 2, as well as valid code to add 1 and 2 together.
You do not need macros for homoiconicity. Macros is not what makes a language homoiconic. But once your language is homoiconic, it is very easy to add macros to it, and macros become much simpler to write. Which is why Lisps have macros as well.