Live data from Hacker News

Arthur Whitney's 'B' Language

kparc.com

81–90 of 109 posts

Re: Arthur Whitney's 'B' Language

#81
post #74
post #49

Earlier quoted context omitted.

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…

License is here: https://shakti.com/license No phoning home etc. although license does say you're limited to 30 days (although remains to be seen if/how that is enforced) FWIW, kx didn't _have_ a 64bit trial before they released it with the phone-home stuff, before that trial was limited to 32bit only (still available & no connection required)

I did not mean to imply otherwise. The phoning home was introduced with the 64bit trial.

If I recall correctly, the 32bit trial used to time out after some number of hours after it was launched. This prevented, e.g., running it continuously as a server. Not sure if they still do that.

Going further back, I also recall early k trials that put limits on the size of the workspace.

Re: Arthur Whitney's 'B' Language

#82
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…

There's miniconda which is much much smaller (a few megs), which can still install shakti AFAIK.

miniconda is just the package manager of anaconda, with no preinstalled packages.

Re: Arthur Whitney's 'B' Language

#83
post #70
post #49

Earlier quoted context omitted.

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

Thank you! Exactly what I was looking for. Even give us a static binary.

Alas, I am getting "Illegal instruction (core dumped)". Will have to try another kernel.

Re: Arthur Whitney's 'B' Language

#84

This code is a horrid abomination. I don't care if this guy is a genius and could single-handedly write the best OS in the history of computing; his code is write-only, unmaintainable garbage. There's nothing elegant or praiseworthy about this at all.

In your opinion. I have no issues with it. But it helps if you work a lot with k/j I guess. It is not write only at all; it just feels like it more as it is so terse that if you change something, it will generally affect more % of the code than in other languages. And the readability; again it is so terse that it probably will take you more time to inderstand an A4 of this than an A4 of C#, however, I find it easier to comprehend complex code written like this than the same code spread out over 100s of files with design patterns sprinkled on top. But ymmv; just until you did significant work in an APL, I am not sure you can comment like you did. It is another world.

In short: Like Whitney, I hate scrolling in code. Multiple high res monitors and with bunches of tabs and files open and then scrolling and trying to figure things out with IDE ‘jump to implementation’, ‘find references’ etc is just really not very efficient compared to this. In My Humble Opinion.

Re: Arthur Whitney's 'B' Language

#85
post #72

Earlier quoted context omitted.

If you don't know the language, of course most things will seem understandable b[Ii]{h:#x;l:0;while(h>l)$[y>x[i:/l+h];l:i+1;h:i];l} b -> function name [Ii] -> type declaration h:#x;l:0; -> initial definitions And the rest of it are bog-standard binary search operations with implicit return of l. Honestly, it's more understandable than Java with annotations or other magic constructs

itsnotthatitcantbereadbysomeonewhoknowsthelanguageitsthatitsincrediblydenseandhardtoreadandlacksanymeaningfulcontextclues

    sentence(lang HumanLanguage){
        if(lang!="EN"){
            throw_exception(UNKNOWN_LANGUAGE_EXCEPTION);
        }
        with subject(combine_adjective_noun("context", "clues")){
            verb[to_be::present::plural]"are"([adjective]"overestimated");
        }
        full_stop;
    }
Do you find this more readable than a simple English sentence?

AW's code is way too terse, but most code is much more verbose than I'd like it to be. Finding the sweet spot is difficult (and it may change when you are coding just for yourself and when there is a larger audience). In order to find a good compromise, it is always interesting to explore all the possibilities in both directions.

We have code with many safety measures, extensive comments and visual clues and we have code like this and, in contradiction with every theory, the terse style is doing quite well in terms of bugs and programmer efficiency. Why? Is that a coincidence? Could we have the best of both worlds?

I do not say you should use this style for your projects, you don't even have to like it a little bit, but criticizing it because of its disadvantages without trying to understand its advantages is not a very productive point of view, in my opinion.

Re: Arthur Whitney's 'B' Language

#86

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.

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

https://pastebin.com/21qiRDi5

Re: Arthur Whitney's 'B' Language

#87

Q is one most important language here at BitMEX. Complicated or not, it's on KDB that all our trades happen, up to $8B in 24H volume last summer - it's highly efficient at its task, and never made us or any of our customers, loose a single Satoshi.

With all due respect, requests to BitMEX during times of high load have >50% probability of hitting a 503 Service Unavailable error. Meanwhile, competitors with similar volume/activity don't have this problem.

Re: Arthur Whitney's 'B' Language

#88
post #81
post #74

Earlier quoted context omitted.

License is here: https://shakti.com/license No phoning home etc. although license does say you're limited to 30 days (although remains to be seen if/how that is enforced) FWIW, kx didn't _have_ a 64bit trial before they released it with the phone-home stuff, before that trial was limited to 32bit only (still available & no connection required)

I did not mean to imply otherwise. The phoning home was introduced with the 64bit trial. If I recall correctly, the 32bit trial used to time out after some number of hours after it was launched. This prevented, e.g., running it continuously as a server. Not sure if they still do that. Going further back, I also recall early k trials that put limits on the size of the workspace.

Yeah the 32bit timeout was removed some time ago

Re: Arthur Whitney's 'B' Language

#89

Whitney is so fascinating to me. His code is simultaneously awe-inspiring and horrifying. It's like he struck a Faustian bargain to gain programming powers beyond the ken of mere mortals, and is now cursed to write transcendently beautiful code that manifests as unintelligible gibberish to everyone else.

Everything surrounding APL gives me that feeling, but then I remind myself that, just like Chinese (which appears just as baffling to those who haven't learned the language but have experience with Latin family ones only), there's a not-insignificant number of people who use the language every day and are highly productive at it.

I like terse code and my style is closer to the early UNIX/K&R, yet I've noticed a lot of people already find that too terse; the "normal" style these days seems to be gradually getting more and more verbose (look at typical C# or Java, for example.)

IMHO the readability argument in favour of verboseness is a bit of a misnomer --- you can easily "understand" a file full of extremely verbosely named functions all consisting of a single line, but that doesn't help at all with seeing the big picture. Judging by the amount of file-flipping and stack-jumping when I have to debug a project in that style, it probably hinders it.

On the other hand, this is "code with a learning curve". You can't glance at it and understand immediately, but once you do take the time to read it carefully, you can understand more of the whole than if it was written in a more verbose style.

Re: Arthur Whitney's 'B' Language

#90

This code is a horrid abomination. I don't care if this guy is a genius and could single-handedly write the best OS in the history of computing; his code is write-only, unmaintainable garbage. There's nothing elegant or praiseworthy about this at all.

Thank you for saving me the trouble of having to write the same thing.

We programmers often seem to forget that we spend far, far more time reading code than writing it, therefore readability should be a (if not the) primary consideration when engineering it.

That said, I do understand where Whitney's terseness impetus comes from: I have always lamented how little of my code will fit on the screen, with the number of vertical lines being the limiting factor; that is precisely why my taskbar is on the left-hand-side. (And don't get me started on monitors designed for watching wide-screen movies -- 1600x1200 FTW!)

As such, I can't really fault his intention as much as his execution, and I feel that ultimately the solution to his (really, our) problem is that all our code (not just his) needs an IDE that can expand such terse definitions as per the current programmer's preferred style. This has been my perspective for many years, especially after wrangling various SQL dialects and the mostly awful formatting preferences of my peers.

As I see it, the ideal solution is to store all code files as its token stream and have a default format that can be customized by each programmer in the IDE. As a result, each program will be stored as its pure content (which would help with version control (so long as whitespace is ignored)) AND each programmer would get to work with their preferred perspective. Of course the problem with this methodology is that the tokenizer and formatter better be flawless or you're f*ed, not to mention the fact that there are various IDEs that people like to work with.

Post reply on HN