News for hackers. Stuff that matters.
Re:Arthur Whitney's 'B' Language by yiyus on Tuesday March 26, 2019 @05:13PM (#19496081)
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 terse style after a while. I understand why this style is not more commonly used, but I really like it.

Re:Arthur Whitney's 'B' Language by mamcx on Tuesday March 26, 2019 @05:42PM (#19496309)
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 make everything so obvious ...

P.D*: Because I'm building a language that try to draw some ideas from kdb

Re:Arthur Whitney's 'B' Language by yiyus on Tuesday March 26, 2019 @06:12PM (#19496486)
You have ivy, for example: https://github.com/robpike/ivy by Rob Pike and, of course, gofmted. I have had a quick look at a few APL implementations and some of them are very readable code (by normal standards).

However, although I totally get your point (I've been there), I have to say there is much more to learn if you try to understand that parallel world. It can take a while, but I think it is worth it.

Re:Arthur Whitney's 'B' Language by 5166cc9c39fa61 on Tuesday March 26, 2019 @05:57PM (#19496401)
> 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 experience, lack of time to read them all is. Also, it's more about thinking of algorithms in terms of matrix and array operations. A lot of the techniques and algorithms can be easily adapted from Matlab.

Re:Arthur Whitney's 'B' Language by 4thaccount on Tuesday March 26, 2019 @08:48PM (#19497293)
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 by avmich on Tuesday March 26, 2019 @09:38PM (#19497516)
"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 by 4thaccount on Wednesday March 27, 2019 @12:45PM (#19502820)
I've flipped through it before, but didn't remember it being very enlightening (note that I didn't read the full thing and do all the excercises). I'll have to give it another shot. Thanks for the tip!
Re:Arthur Whitney's 'B' Language by jdmoreira on Tuesday March 26, 2019 @05:18PM (#19496116)
I would love to take a look at your notes. I'm fascinated by this and would greatly appreciate any help approaching it
Re:Arthur Whitney's 'B' Language by yiyus on Tuesday March 26, 2019 @05:32PM (#19496224)
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 find any, please let me know.

Re:Arthur Whitney's 'B' Language by gnulinux on Wednesday March 27, 2019 @09:32AM (#19500623)
> b.c

> That was the easy part. Now it gets complicated.

Haha lol'ed. These notes are amazing. Thank you!

Re:Arthur Whitney's 'B' Language by VictorSCushman on Tuesday March 26, 2019 @10:20PM (#19497704)
Thank you! This is fantastic!
Re:Arthur Whitney's 'B' Language by v_dev on Tuesday March 26, 2019 @07:33PM (#19496903)
You are a hero
Re:Arthur Whitney's 'B' Language by jdmoreira on Tuesday March 26, 2019 @05:34PM (#19496245)
Thank you! This is awesome
Re:Arthur Whitney's 'B' Language by patrec on Thursday March 28, 2019 @02:36AM (#19509789)
I assume you actually managed to compile the code and run t.b? What invocation did you use?
Re:Arthur Whitney's 'B' Language by aleph- on Tuesday March 26, 2019 @10:48PM (#19497799)
I'd love a copy of the notes if you have them.