Hacker News new | ask | show | jobs
by alex_muscar 1578 days ago
That's a nice project idea. Made me try it in common lisp which comes with a compiler built in. It's fairly doable. The only downside is the big executable sizes for SBCL and CCL, and the relatively slow startup times for ECL.
2 comments

I agree. Your comment got me thinking about a lisp dsl for awk-like operations. txr lisp[0] comes with one of these.

[0] https://www.nongnu.org/txr/txr-manpage.html#N-000264BC

I would love to buy a TXR book. It seems like such a powerful tool, and I totally lack any context or understanding of how to get started with it!

I got started with Awk and Sed by just reading through the manuals and putting in the effort to understand the various code snippets I saw online. But that was when I was much younger and "fresher" than I am now. Is TXR worth it?

I hear the D compiler has pretty fast compile times. I'm not sure how low the syntactic noise can be gotten. Of course, with very slow compiles it will mostly seem not very pointful.

It works with a C backend [1], too, and TinyCC/tcc can compile & launch programs in 1-2 milliseconds - faster than the start up time of most interpreters, actually. With a quick changeover to 'gcc -O3' for bigger data inputs/a more saved-away-tool. Personally, I find the C backend too syntactically noisy and Nim programs run as fast as optimized C anyway. So, I only ever use the Nim one.

Anyway, I think it's probably at least a good teaching tool for kids to get comfortable with code generation thinking, etc. A DSL you invent yourself might be easier to remember than a brand new foreign prog.language like sed/awk/'perl -na' that also have implicit loops. With Python you could probably get pretty far just doing 'eval'. At the least, even if you cannot remember your own DSL, well then this will help you appreciate the challenge prog.language designers face. So, either way it's kind of a pedagogical win.

And even if you don't connect CSV column headers with variables/etc, as Ben observes it's not an awful way to test out little "How do I use this <MY PROG LANG> library?" utterances. Bash/zsh become your repl with their shell history/etc.

[1] https://news.ycombinator.com/item?id=30191905