the way macros are expanded, the code is searched for references of the macro. If a referenence is found, the macro is executed and the code altered with the results of the macro.
The macroexpander will then "stupidly" rerun against the code, over and over again, until there are no more macros to expand.
This crude behavior allows you to have recursive macros, but it's not actually doing anything all that "smart"- I think you're reading more into the complexities of recursive macros than is probably there.
This is what I originally had in mind. As far as I can tell, this doesn't work for bytecode-compiled Lisp, correct? (Since it would compile it as a function call, although it's a macro...) So does that mean every implementation of Lisp has to have a single-pass interpreter in it?
Well, every implementation of Lisp does indeed contain an interpreter: eval!
But the way Lisp compilers deal with recursive macros is to not allow them. From the Common Lisp spec:
"All macro and symbol macro calls appearing in the source code being compiled are expanded at compile time in such a way that they will not be expanded again at run time."
That rules out recursive macros. I think they're allowed when Lisp is being interpreted, but you should probably just not use them.
Unless I've messed up the parentheses, those should be equivalent. I think the problem is that expand-metafn-call is being called by setforms when it shouldn't be. (Or alternatively, it shouldn't give up and die.) The example works if you first turn expand-metafn-call into a nop:
No, it was a mistake by me: Anarki works similarly to ArcN in this case. Sorry for muddying the waters. ^^
The problem appears to be that the current '= was meant for use with the older ssyntax, which supports only : for composition. I'll take a better look maybe later, I'm just home from work, cooling off (very hot in the philippines right now)
The "invert" thing is really confusing, I didn't add docstrings to all the '= related stuff because of that. Me, I say refactor '=. LOL
Edit: Fixed on the git.
(def metafn (x)
(set x (ssyntax x))
(and (acons x) (in (car x) 'compose 'complement)))
I would guess that pg is hoping hash tables and alists can fill the roles that keyword parameters otherwise would be used for... "need keyword parameters? have the function accept an alist."
Same with defop. Accessing the GET/POST arguments to an operation is done via (arg req "foo"). It would have been worlds nicer if I could just define something like
Great tool- I will probably use it at some point...
Does that change in header* break regular web pages from serving? If not, how is it possible for Content-type to be the same for SVG and regular web pages?
Changing the Content-type just lets the browser know that you're using xhtml rather than html. This will occasionally cause some issues when using svg.arc in combination with html.arc because the browser will expect your html to be xhtml compliant. This could probably be smoothed over by creating an xhtml version of html.arc and modifying the generated code so that its xhtml compliant.
The server will need to specify arbitrary content-types eventually, and that's way easier than supporting xhtml, so specifying an arbitrary MIME type seems like the obvious solution to me. Also, the official MIME type for SVG is image/svg+xml, so trying to use xhtml both for SVG and HTML seems like a fragile hack.
Thanks for the great replies- I was actually also wondering how the RSS feed in news.arc deals with this... Is there some hack in there for overriding the Content-Type or are web browsers more forgiving for RSS feeds? I couldn't find any specific handling in news.arc for this issue on inspection the other day...
Firefox's Live HTTP Headers plugin tells me that news.ycombinator.com/rss has "Content-Type: text/html; charset=utf-8". I imagine RSS clients are not very strict about what they accept.
For me, it's way too early to tell whether Arc is worth a significant investment in time or not. The potential seems be there, but the actuality could be different.
I think pg has many responsibilities, and it's quite possible that other demands on his time could cause Arc to stall for a while (i.e. 2003-2008) or flatline.
I think srv.arc is still pretty rough- I've been able to uses it with success, however, despite the quirks.
PG is not really a big fan of consistency. I think his reasoning is that consistency is another word for duplication and if you have it you're probably not using the most concise definition of your problem. I think this explains the inconsistencies in srv.arc. I suspect, as time goes on, this file will become smaller and cleaner as pg refactors it- However, I doubt it will become more "consistent".
One classic example of the lack of functions "for consistency's sake" in arc is that there is no 'cdar.
When you say you've been able to use srv.arc with success, do you mean the unmodified arc2.tar version or a patched version such as Anarki? Let me clarify that when I said above that srv.arc was broken, I was referring to the official version.