4 ms·
It's really not different, particularly the first example. If you're going to claim it is different, then I claim that LISP can't do addition. When you have (+
by souprock 6y ago
It's really not different, particularly the first example.
If you're going to claim it is different, then I claim that LISP can't do addition. When you have (+ 1 1) that is something completely different, because you have the syntax fucked up. It's not addition like I know it, so it doesn't count.
- dunefox 6y agoIt's very different since Lisp doesn't 'compile and run strings', it treats code as data structures - which means you can manipulate code just like data since they live in the same space, so to speak. And also, it has nothing to do with the syntax (+ 1 1), the keyword is homoiconicity.
- souprock 6y agoYou mean a toy LISP or Scheme? Any serious LISP system uses a compiler. It compiles and runs strings. The "eval" creates native binary executable code. No decent-performing system totally skips compilation. You just don't notice that it is happening. Even a web browser compiles the javascript before running it; that is what a JIT does. I mentioned the syntax "(+ 1 1)" because you're trying to disqualify C++ homoiconicity on a superficial syntactic basis. If you can do that, then it is equally valid to say that LISP can't do simple addition.
- dunefox 6y agoNo, I mean that it has nothing to do with compilation of strings. Homoiconicity means code is represented via data structures, so it can be manipulated with the language itself. C++ is not homoiconic.
- souprock 6y agoYou aren't calling them strings, but they are. I didn't specify "NUL-terminated ASCII" or anything like that. Call them S-expressions if you prefer. It makes no difference. C++ can manipulate itself. Granted, you'll want a library such as LLVM, but you can get the job done yourself if you are a glutton for punishment. Code is represented via data structures on normal (von Neumann) hardware. LISP is every bit as compiled as C++. Both forms of C++, human-readable and compiled, can be manipulated. It's the same as LISP, except that "human readable" is debatable for any form of LISP.
- fishmaster 6y agoIt's not the same and it's not represented as strings in Lisp, but I'm not going to commit further. You can read up on homoiconicity and Lisp on the internet, then you will see the difference.
- souprock 6y agoOK, done. I read up on both. (and had earlier; I'm not unaware) Still I see no difference. There is none. Superficial syntactical differences do not matter, unless you'll agree that LISP can't do addition. BTW, in LISP, actual usage of the homoiconicity is the surest way to make a mess of unmaintainable code.