Ask HN: LISPers, do you use homoiconicity (code-as-data)?
So IMO the biggest reason to use LISP over other languages that also provide first class functions and closures is homoiconicity. On the other hand, when I was using LISPs as my primary language, I found that I wasn't using this feature as much as I imagined I would. And when I did, it was arguably superfluous.
So my question is two fold:
1. Do you have any examples (aside from PL/compiler related work) that LISPs code-as-data features are used to solve problems that otherwise would have been much harder?
2. Given that you've likely substituted 50,000 lines of Java code with 300 lines of LISP, it goes without saying that you are a lone wolf programmer. But do you, yourself, ever have trouble understanding what you've written after some time? Also, how do your refactors go? Do you do them at all?
8 comments
[ 2.6 ms ] story [ 11.8 ms ] threadEven if I need to compose a query for a more flexible questioning than using a value parameters, this is something that typically could be done by combining 2 or 3 substrings, there is not typically the need to work queries as much as I do with HTML and hiccup.
So at the end I moved to HugSQL (the modern+popular "write your queries in SQL"-philosophy library) instead of YesQL (the modern+popular "write your queries in clojure"-philosophy library, similar in approach to korma).
Polynomials can be easily manipulated, such as taking a derivative, and the result is still valid executable code.
Macros use homoiconicity all the time, doing code walking and code expansion.
Functions can construct and return functions easily.