Reputation
2,237
Next tag badge:
107/100 score
8/20 answers
Badges
9 21
Newest
 Nice Answer
Impact
~50k people reached

Jun
16
revised Using .ico files as icons when creating executables in DrRacket IDE
edited tags
Apr
26
comment What should web programmers know about cryptography?
@Ajoy I've changed the link to something that's more relevant.
Apr
26
revised What should web programmers know about cryptography?
This is a _much_ better link.
Apr
7
awarded  Nice Answer
Feb
26
awarded  Good Answer
Feb
25
awarded  Enlightened
Feb
24
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG Homoiconicity is what allows Lisp languages to eval on the list structures instead of the textual form, and for those list structures to be transformed (via macros) prior to execution. Most languages' eval works on text strings only, and their capabilities for syntax modification are much more lacklustre and/or cumbersome.
Feb
24
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG With that understanding, macros do not work at read-time. They work at compile-time in the sense that if you have code like (and (test1) (test2)), it will get expanded into (if (test1) (test2) #f) (in Scheme) just the once, when the code is loaded, rather than each time the code is run, but if you do something like (eval '(and (test1) (test2))), that will compile (and macro-expand) that expression appropriately, at runtime.
Feb
24
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG Also, "parse" is called read in Lisp. This distinction is important, because eval works on actual the list data structures (as mentioned in my answer), not on the textual form. So you can use (eval '(+ 1 1)) and get back 2, but if you (eval "(+ 1 1)"), you get back "(+ 1 1)" (the string). You use read to get from "(+ 1 1)" (a string of 7 characters) to (+ 1 1) (a list with one symbol and two fixnums).
Feb
24
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG Rainer's point, I believe, is that if you eval or load code in any Lisp language, macros in those will get processed too. Whereas if you use a preprocessor system as proposed in your question, eval and the like won't benefit from the macro expansion.
Feb
23
awarded  Mortarboard
Feb
23
revised What about LISP, if anything, makes it easier to implement macro systems?
Syntax-highlight all the code blocks
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG I would say that Lisp languages are not constrained by Algol-style syntax, so good macros are easier to design. What I mean is, you don't have to consider infix operators, curly brace blocks, semicolons, etc. In Lisp, there's just one uniform syntax (S-expressions), so it's easier to design macros tastefully. Of course, that's just my subjective opinion, but there is really no objective answer to "why is Lisp better". (BTW, Lisp, not LISP.)
Feb
23
revised What about LISP, if anything, makes it easier to implement macro systems?
Add syntax-rules and syntax-case examples.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG sweet.js is not harder to use than Lisp macros, actually. sweet.js has two types of macros, rule and case macros, which correspond to Scheme's syntax-rules and syntax-case respectively (in a very loose sense). Both sweet.js and Scheme macros look and feel very similar.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@RenéG What do "higher level" macros look like, and what would they do?
Feb
23
comment What did Stallman mean in this quote about implementing other languages in Lisp?
@Michael But that's exactly the point, isn't it? Because Lisp macros are so much more "natural", Lispers reach for macros when users of other languages would just give up. This gives Lisp languages reach into some problems that are hard to solve in other languages.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
Right, you can write procedural (versus declarative) macros in Lisp languages, which is what allows you to do really advanced stuff. BTW, this is what I like about Scheme macro systems: there are multiple to choose from. For simple macros, I use syntax-rules, which is purely declarative. For complicated macros, I can use syntax-case, which is partly declarative and partly procedural. And then there's explicit renaming, which is purely procedural. (Most Scheme implementations will provide either syntax-case or ER. I've not seen one that provides both. They're equivalent in power.)
Feb
23
revised What about LISP, if anything, makes it easier to implement macro systems?
Fix typo.
Feb
23
awarded  Nice Answer