Hacker News new | ask | show | jobs
by 5166cc9c39fa61 2643 days ago
I think a good introduction to this style of coding is the first "proof of concept" prototype interpreter for a small subset of J, also written by Whitney:

https://code.jsoftware.com/wiki/Essays/Incunabulum

Once I realized it was K&R C, I thought it was pretty straightforward.

2 comments

This is worth a look. Some of the old A+ stuff is as well. I'm told by reliable sources that an awful lot of Art's code looked like this over the years; even the more recent K7 stuff. Art's gonna do his thing. Opinions differ as to whether or not it is a generally good idea, but you can't argue with the results, and at this point I find stuff like the J source code to be fairly readable, even if it is really different from what most people are used to. Basically, you're just expressing C as APL primitives. If you understand APL primitives, it's not so bad.

If you want to see APL expressed as C primitives, something like Nial is pretty good: https://github.com/danlm/QNial7

I ran it through gcc -E and clang-format.

https://pastebin.com/21qiRDi5

And not surprisingly that makes it less readable. It is a lot harder to have one-character names when you need to scroll across many pages to look up what they mean. So the more code you have, the longer code you need. As Eric Evans points out, naming things in computer code is difficult and important; wrong names can be misleading. This style avoids the problem by avoiding names.