Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You can implement a macro system in 30 lines of Lisp. All you need is read, and it’s easy.

The linked pastebin isn't a macro system. It's merely a macroexpansion system, it needs to be evaluated. And it's not as simple as merely wrapping it in 'eval' because of subtleties in getting at the right lexical scope.

More generally, no fair claiming macros are easy because you managed to build them atop a lisp. You're using all the things other comments here refer to; claiming it's all 'read' is disingenuous.

I'm still[1] looking for a straightforward non-lisp implementation of real macros. The clearest I've been able to come up with is an fexpr-based interpreter: http://github.com/akkartik/wart

[1] From nearly 2 years ago: http://news.ycombinator.com/item?id=1468345




The currently front-paged Julia claims to have macros in a non-lisp. https://news.ycombinator.com/item?id=3606380


And there's Dave Moon's PLOT (Programming Language for Old Timers). http://news.ycombinator.com/item?id=537652

With the interesting critique that "objects" are better than s-expressions for representing sourcecode. (BTW, Moon did a lot of work on Lisp.)

I've too thought that s-expressions don't necessarily contain as much information as you'd want. Using Rich Hickey's word from "Simple Made Easy", maybe they're used to "complect" visual presentation and internal representation.

Then again, there's metadata...


Thanks for those links (wes-exp as well). But I meant a non-lisp implementation of lisp macros. Obviously common lisp and racket qualify, but I'd love to see an implementation that's as simple as possible without needing to be production-quality.


Also, is PLOT actually available? I think I must have come across it 3 times and searched for a download link without luck.


Last I heard, it's not — Moon didn't think his work was high enough quality to release, and invited others to do so.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: