Live data from Hacker News

Arthur Whitney's 'B' Language

kparc.com

51–60 of 109 posts

Re: Arthur Whitney's 'B' Language

#51
post #22
post #9

Earlier quoted context omitted.

On a possibly unhelpful tangent, I'm expecting it to look something like this: https://code.jsoftware.com/wiki/Essays/Incunabulum

It sure does: http://kparc.com/b/b.c

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.

Re: Arthur Whitney's 'B' Language

#52
post #51
post #22

Earlier quoted context omitted.

It sure does: http://kparc.com/b/b.c

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

Re: Arthur Whitney's 'B' Language

#53
post #39
post #38

Earlier quoted context omitted.

I think this is one of the reasons he does not release his code. K is such a small language, with a very limited number of primitives, that were chosen for the task they wanted to solve. Every user would want to change that one he never uses for that one he uses the whole time, so we would have lots of k implementations, each of them with its own mesh of spaghetti code and slightly different behaviors. Talking for my…

I think the closest thing is https://github.com/kevinlawler/kona

A more up to date version: https://github.com/JohnEarnest/ok

Re: Arthur Whitney's 'B' Language

#55
post #28

Earlier quoted context omitted.

I wish* exist a simplified implementation of this (or APL) in "normal" looking code. Array languages are the most "obscure" of all paradigms I have looked into. Even concatenative ones have some few resources about how work. Also, the community live in a parallel world! So when asked about stuff, redirect me to https://code.jsoftware.com/wiki/Essays/Incunabulum or https://github.com/kevinlawler/kona as if it somehow…

> Array languages are the most "obscure" of all paradigms I have looked into. Even concatenative ones have some few resources about how work. Have you tried looking at APL books? There are dozens of books on APL you can find. There are journals and conference proceedings from ACM, IBM, Dyalog, and Vector UK. I started to get into APL more seriously last year and lack of resources is definitely not a problem in my exp…

Well there are books like "Mastering Dyalog APL", but they don't help you think in the language. There is the "Finnish APL Idioms" book which helps a bit. APL and J certainly have libraries, but a lot of functions and libraries that are builtin to most languages are omitted from APL as you can replicate with 3 characters. That's where knowing idioms helps. I am just a novice, but really enjoy writing APL & J. Aaron Hsu has been on a couple of APL related posts on HN that I have linked to multiple times. He is a scheme guru that switched to APL a few years back and wrote the Co-Dfns parallel GPU compiler for Dyalog APL. He has some enlightening talks on YouTube as well. I mention him here as his APL code is extremely terse and similar to Whitney's C, and he did an excellent job defending it in the HN post which changed the way I look at code. Second, as a University TA, he's taught multiple courses on APL as a first programming language and has talked about writing a book that tries to teach how to THINK in APL and not just this is how you transpose the matrix using this symbol...etc. My problem is that I know what the symbols do, but don't know how to switch from imperative/OO thinking to how to think in terms of array primitives (inverse, transpose, sort, outer product...etc).

Re: Arthur Whitney's 'B' Language

#56
post #39
post #38

Earlier quoted context omitted.

I think this is one of the reasons he does not release his code. K is such a small language, with a very limited number of primitives, that were chosen for the task they wanted to solve. Every user would want to change that one he never uses for that one he uses the whole time, so we would have lots of k implementations, each of them with its own mesh of spaghetti code and slightly different behaviors. Talking for my…

I think the closest thing is https://github.com/kevinlawler/kona

Kevin Lawler and Scott Locklin (posts on here sometimes) tried to make a tsdb similar to kdb+ called kerf I think. I don't think it worked out, but it would've been nice to have a more affordable competitor.

Re: Arthur Whitney's 'B' Language

#57
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.

Now I think you're right, but there is two strategies which boils down to the following: "you can either make a program that's so complex there is no obvious defect, or you can make a program so simple it's obvious there is no defect." What it says is that the hard part to make the next programmer understand what the machine does is not reading code, it's code complexity. Training yourself to read terse code is O(1),…

Worth noting that in the Excel world (a primitive array language), for business users, dense formulas without spaces or new lines are the norm (although it is possible to use those features). Syntax highlighting and step-by-step evaluation features make it easier to work with.

Re: Arthur Whitney's 'B' Language

#58
post #40

Earlier quoted context omitted.

Now I think you're right, but there is two strategies which boils down to the following: "you can either make a program that's so complex there is no obvious defect, or you can make a program so simple it's obvious there is no defect." What it says is that the hard part to make the next programmer understand what the machine does is not reading code, it's code complexity. Training yourself to read terse code is O(1),…

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 necessarily more meaningful. It's pretty common for everyday programmers to use single letters for something like a loop induction variable. Sometimes longer is just... longer. Consider these three semantically identical K definitions:

    a:{x*x}
    b:{[n]n*n}
    c:{[number]number*number}
Is that third version really clearer than the first?

Re: Arthur Whitney's 'B' Language

#59

Earlier quoted context omitted.

> Array languages are the most "obscure" of all paradigms I have looked into. Even concatenative ones have some few resources about how work. Have you tried looking at APL books? There are dozens of books on APL you can find. There are journals and conference proceedings from ACM, IBM, Dyalog, and Vector UK. I started to get into APL more seriously last year and lack of resources is definitely not a problem in my exp…

Well there are books like "Mastering Dyalog APL", but they don't help you think in the language. There is the "Finnish APL Idioms" book which helps a bit. APL and J certainly have libraries, but a lot of functions and libraries that are builtin to most languages are omitted from APL as you can replicate with 3 characters. That's where knowing idioms helps. I am just a novice, but really enjoy writing APL & J. Aaron H…

"J for C programmers" is, in my opinion, an excellent resource for how to think in array-oriented style. http://www.jsoftware.com/help/jforc/contents.htm

Re: Arthur Whitney's 'B' Language

#60
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

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.

Post reply on HN