J one-page interpreter fragment (1992)
code.jsoftware.com
code.jsoftware.com
Thus proving it's horrible, and probably underhanded, code.
I know Whitney's style is a strict no-no, but it's beautiful how he regards C as a pliable material, rather than as a hard tool with standard modes of use, and uses it to define his own rudimentary DSL to build J on top of it.
It's sort of like performance art (very well-paid performance art) rather than something mere mortals could learn and use.
If I were to be flippant, I would just say "not with that attitude!" But, mere flippancy being (rightly) not welcome here, I would also point out that all code is opaque and difficult to people who haven't learned how to read it. I think this kind of code should be taken, not as absolutely unintelligible (elsethread at https://news.ycombinator.com/item?id=34052034, zwerge posted a link to their dissection of it)—after all, part of the beauty of coding is that we all have access to a source of absolute truth (the code does what the compiler says it does)—but as either a fun diversion (my personal perspective) or as a goal. If making the code-reading part of your brain fluent in this sort of code is something to which you aspire—and there's no reason you should, but also no reason you shouldn't—then you can do it, with lots of patience!
I've not seen attempts to aid learning of basic skills for reading diverse coding styles. The space is large, from "eyeball abstraction" over "code is 90% repetition and boilerplate", to APLish "DO Repeat Yourself! At every callsite! With variations! ... each is like 4 characters", to terse lambda "code is documentation for humans, and only secondarily executable", to ... . There are skills involved with reading each style. And non-obvious tradeoffs to use. But even within individual styles, aid seems more "write and read a lot of code, and you'll eventually get the hang of it", and less "here, let me break down for you what I'm doing, what skills I'm using, when I read this". Perhaps there's some "live coding^H^H^He reading" on yt? Or how about an interviewer pair-reads code with a language expert?
While linters trending increasingly strict, towards canonical representation, raises hope for the old dream of AST-based coding, it does crush an axis of expressive power, for better and worse.
Hmm, I wonder if one could generate an ML training corpus to answer "explain what this bit of code here is doing and why"? Or perhaps, "create a minimum-ink compressed summary of these files"? Or even aspire to "rewrite this Java code in the style of APL"? :P (Ha - further down this page, ChatGPT https://news.ycombinator.com/item?id=34053932 )
I'm actually pretty eager to learn and use what you might call the Array Paradigm. Here's a comment thread from this summer: https://news.ycombinator.com/item?id=31380292 Some good info surfaced, and you can see for yourself how excited I got. :) Anyway...
> all code is opaque and difficult to people who haven't learned how to read it.
Sure, but there's a difference between, say, Logo and J in terms of available educational materials, eh?
My complaint isn't that the array languages are particularly hard (they're not), it's that they are obscure.
( "elsethread" I love it! I'm going to use that I think. Cheers! )
Heh.
No, I realize the code is from 1989 and gets() was not on the hitlist by then.
What is not so clear is if the first the author wrote after studying the posted code for a week, looked the same? I mean even in 1989 this must have been a bit controversial/extreme[1], but there is no mention of those aspects. I'm not sure what is being communicated, really.
[1] I don't think I had started writing C for real by then but if this was Basic code I would have screamed at it. :)
The style was just as unusual at the time, though I think there was more variety in style generally, and lower standards most places (most of us didn't have open source or internet discussion to learn from).
An Implementation of J – Incunabulum (2008) - https://news.ycombinator.com/item?id=28491562 - Sept 2021 (16 comments)
J one-page interpreter fragment (1992) - https://news.ycombinator.com/item?id=25902615 - Jan 2021 (43 comments)
J one-page interpreter fragment (1992) - https://news.ycombinator.com/item?id=14463874 - June 2017 (26 comments)
The J Incunabulum (Remembering Ken Iverson, 2004) - https://news.ycombinator.com/item?id=12654054 - Oct 2016 (1 comment)
Arthur Whitney's One-page Interpreter (1992) - https://news.ycombinator.com/item?id=8533843 - Oct 2014 (50 comments)
I feel like there have surely been threads?
There are plenty of lessons to be learned from languages that are not "the norm". Having more ways to think about the problems helps.
It’s also amusing that he chooses to spell out “noun” and “verb” but nothing else. Maybe his brain got tired by that point and could no longer remember the meaning of so many single-letter variables and functions.
That seems reasonable to me. The way I understand the story, Whitney wrote this as a "sketch". Its purpose was not to be an industrial strength interpreter, but to communicate a few key concepts so another skilled programmer (Roger Hui) could pick it up and run with it.
This is the output of an obfuscator, and the refusal of the J people to admit it makes them untrustworthy.
J is "tool for thought" because there is a relatively - comparing to other languages - short distance between a thought and its implementation in the language. When e.g. somebody writes Java, her fingers used to type "for(int i = 0; i < ...; i++) {" without much thought. In J this whole construction is just hidden inside the language.
Only for some limited kinds of thoughts, to be sure.