Live data from Hacker News

Arthur Whitney's 'B' Language

kparc.com

61–70 of 109 posts

Re: Arthur Whitney's 'B' Language

#61
post #60
post #52

Earlier quoted context omitted.

I think the problem is, we intuitively estimate the readability of code based on the space it takes up, when we should take into account the information density. That code is extremely readable - if you assume it will take just as long to understand as the entirety of the GCC compiler: https://github.com/gcc-mirror/gcc

Read "A programming language", where APL came from - https://www.amazon.com/Programming-Language-Kenneth-Iverson/... - you might get more understanding why it is the way it is. It is the mathematical notation, put into, as Dijkstra expressed, "technologies of the past", completed (to be Turing-complete) and made executable. At least, I think, this is the basic idea.

[deleted]

Re: Arthur Whitney's 'B' Language

#62
post #25

Earlier quoted context omitted.

I would love to take a look at your notes. I'm fascinated by this and would greatly appreciate any help approaching it

Here it is for anyone who wants to have a look: https://docs.google.com/document/d/1W83ME5JecI2hd5hAUqQ1BVF3... I recommend you to keep the original files at hand for reference. Once you have understood it the first time, they are a better reference than my many pages document. When AW says he hates scrolling, it is not because he is lazy, it just doesn't go well with this style. I am sure there are mistakes. If you…

Thank you! This is fantastic!

Re: Arthur Whitney's 'B' Language

#63

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.

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

Re: Arthur Whitney's 'B' Language

#64
post #4

Whitney’s code is what I expect code to look like post-singularity when hyper intelligent AI program themselves!

+1 thanks

You got me thinking how AlphaGo reinvented the style of Go for human players. A real AI taught one of our programming languages would code in a way that would be alien to us.

Whitney’s code is fascinating. I thought that someone might use a good C IDE to rename symbols to longer human readable names, but, that would harm the terseness of the code.

Re: Arthur Whitney's 'B' Language

#65
post #23

I studied this code for a long time. I have lots of notes, going through everything almost line by line. I would be embarrassed of making them public because I never finished (at some point, I was just rewriting the x64 reference), but if somebody is interested I do not mind sharing. I would recommend everyone doing C to have a very careful look at this. The code is full of nice tricks and you start appreciating the…

I'd love a copy of the notes if you have them.

Re: Arthur Whitney's 'B' Language

#66
post #40

Earlier quoted context omitted.

I did, once, when I was at school. It was great - everything was so fast to type, the program (a somewhat complex game) would fit in on two screens. I almost finished it in a week. And the I had exams, and did not touch the computer for two weeks. When I came back, I forgot it all. Cx? Dzy? Those names were meaningless. This was a very importantly lesson - programs must be maintaineable. Unless you want to spend your…

Many people use descriptive variable names to carry semantic information. APLers use extremely consistent, stereotypical naming conventions which also carry semantic information. Think "Hungarian Notation" except it's just the prefix part. With consistently applied terse names, the same idea will result in the same code. Easier to visually pattern-match. It's also worth considering that longer names are not necessari…

I think the good rule of thumb is to have longer names in bigger scopes. So a variable for short loop or an argument to 1 line function can be single char, while arguments to medium length functions are a word, and globals (including functions) are one or multiple words.

To get to your example, the preferred signature would be:

    square:{x*x}

Re: Arthur Whitney's 'B' Language

#67
post #52
post #51

Earlier quoted context omitted.

I'm so tempted to just respond with "wanker", though I know HN norms don't allow that. Either the code is for human consumption (in which case, fulfil that goal) or you're writing demoscene assembler which displays virtuosity without any positive impact on society.

I think the problem is, we intuitively estimate the readability of code based on the space it takes up, when we should take into account the information density. That code is extremely readable - if you assume it will take just as long to understand as the entirety of the GCC compiler: https://github.com/gcc-mirror/gcc

The code I linked to was written in one session (probably) and it really isn't comparable to GCC in complexity. It's an interpreter, but one where the author has made no attempt to make the process of interpretation legible. He's too busy "achieving" things with his code.

I guess there should be a niche for people like that, but the APL/post-APL community seems to think that Arthur has special computer science knowledge that can be best (or only) expressed in this form. We all know that's bullshit.

Re: Arthur Whitney's 'B' Language

#68
post #40

Earlier quoted context omitted.

I did, once, when I was at school. It was great - everything was so fast to type, the program (a somewhat complex game) would fit in on two screens. I almost finished it in a week. And the I had exams, and did not touch the computer for two weeks. When I came back, I forgot it all. Cx? Dzy? Those names were meaningless. This was a very importantly lesson - programs must be maintaineable. Unless you want to spend your…

Many people use descriptive variable names to carry semantic information. APLers use extremely consistent, stereotypical naming conventions which also carry semantic information. Think "Hungarian Notation" except it's just the prefix part. With consistently applied terse names, the same idea will result in the same code. Easier to visually pattern-match. It's also worth considering that longer names are not necessari…

Most people have difficulty with the fact that an array expression can very compactly represent some powerful functions. For example,

  (+/*)\:
is matrix multiplication. The following computes the transitive closure of a binary relation (represented as a boolean square matrix):

  {x|x(|/&)\:x}
Its core has a similar "shape" as matrix multiplication:

  (|/&)\:
So in a sense variable names don't matter all that much! To grok this code you have to stop thinking in terms of item at a time operations and start thinking of operations over collection of items. If you know how to write unix shell pipelines you are already somewhat familiar with this paradigm except that a shell doesn't provide most of the more useful features of array languages!

Re: Arthur Whitney's 'B' Language

#69
post #27

Programming is not telling the machine what to do. That's the easy part. What programming is about, and what's hard, is telling the next programmer what the machine does. This makes the easy part a bit easier, and the hard part much harder, than using C. And I already disliked C to begin with, for similar reasons.

It is tiring and unproductive to parse other programmers' BS made-up semi-languages. If your shit is so complex you can't handle "tab-switches" you are doing it wrong. Stop crafting these 20-dimensional rhombicosidodecahedrons if you work in a team, please. Just use regular paper and fold a bunch of swans.

Re: Arthur Whitney's 'B' Language

#70
post #49
post #44

Earlier quoted context omitted.

Binaries can now be obtained from Anaconda: https://anaconda.org/shaktidb/shakti Not sure what was on gitlab, I assume not source?

The install for Anaconda is over 500MB. If it is anything like k, the "shakti" binary is probably small, maybe under 260KB. Is there a way to download just the shakti binary? What are the restrictions on the trial version of shakti? Is it time-limited (e.g., 30 days)? Does it need an internet connection to be able to phone home? (I think FD/Kx started doing this with their 64bit trial.) The backstory for all this is…

Just download it ‘manually’ https://anaconda.org/shaktidb/shakti/files and tar -xf

bin/k is 185K

Post reply on HN