Readit News logoReadit News
mlochbaum commented on My Ideal Array Language   ashermancinelli.com/csblo... · Posted by u/bobajeff
pavlov · 20 days ago
Hmm. I guess it if was BQM, it would be pronounced “bequem” which means comfortable in German.

And a comfortable APL is clearly an oxymoron.

mlochbaum · 20 days ago
Ordinarily I'd make fun of the Germans for giving such an ugly name to a nice concept, but I've always found "comfortable" to be rather unpleasant too (the root "comfort" is fine).
mlochbaum commented on My Ideal Array Language   ashermancinelli.com/csblo... · Posted by u/bobajeff
pavlov · 20 days ago
Why is it BQN instead of BQM? Clearly the idea was to increment every letter from APL, but then they had to go one further on the third letter.
mlochbaum · 20 days ago
It's just. So gross. Say it. Sudden interruption of slime coming up your throat. Like walking out the door into a spiderweb. Alphabetically I was mistaken but in every way that matters I was right.
mlochbaum commented on My Ideal Array Language   ashermancinelli.com/csblo... · Posted by u/bobajeff
nromiun · 20 days ago

  ⊢×0≠∧˝˘∧⌜∧˝           # Marshall & Dzaima (tacit!)
  (≠⥊∧´)˘{×(⌾⍉∧)0≠} # Dzaima & Rampoina
  {×(∧˝˘∧≢⥊∧˝)0≠}     # Dzaima
Call me old fashioned and stuck in C style syntax but I can't imagine anyone describing this as beautiful art.

mlochbaum · 20 days ago
Well, do you know how it works? Don't judge a book by its cover and all. Although none of these are entirely aiming for elegance. The first is code golf and the other two have some performance hacks that I doubt are even good any more, but replacing ∧≢⥊ with ∧⌜ in the last gets you something decent (personally I'm more in the "utilitarian code is never art" camp, but I'd have no reason to direct that at any specific language).

The double-struck characters have disappeared from the second and third lines creating a fun puzzle. Original post https://www.ashermancinelli.com/csblog/2022-5-2-BQN-reflecti... has the answers.

mlochbaum commented on Piano Keys   mathpages.com/home/kmath0... · Posted by u/gametorch
bruce343434 · a month ago
On my (accoustic) piano, the black keys are just as wide as the back ends of the white keys. This is achieved by shifting the position of the black keys a bit, instead of centering them right between the white keys.
mlochbaum · a month ago
The point that the article is addressing (but you have to ignore the image and study the equations to see this!) is that this sort of shifting can't equalize everything. In the span of 3 white keys C to E at the front, you have 2 black keys at the back, so if you take r to be the ratio of back-width to white key front-width then you have 3 = 5r. But in the 4 keys F to B, you've got 3 black keys so 4 = 7r. No single ratio works! So the article investigates various compromises. The B/12 solution is what seems to me the most straightforward, divide white keys in each of the sections C to E and F to B equally at the back, and don't expect anyone to notice the difference.
mlochbaum commented on Blazing Matrix Products   panadestein.github.io/blo... · Posted by u/Bogdanp
mlochbaum · 2 months ago
The relevant operations for matrix multiply are leading-axis extension, shown near the end of [0], and Insert +˝ shown in [1]. Both for floats; the leading-axis operation is × but it's the same speed as + with floating-point SIMD. We don't handle these all that well, with needless copying in × and a lot of per-row overhead in +˝, but of course it's way better than scalar evaluation.

[0] https://mlochbaum.github.io/bencharray/pages/arith.html

[1] https://mlochbaum.github.io/bencharray/pages/fold.html

mlochbaum · 2 months ago
And the reason +˝ is fairly fast for long rows, despite that page claiming no optimizations, is that ˝ is defined to split its argument into cells, e.g. rows of a matrix, and apply + with those as arguments. So + is able to apply its ordinary vectorization, while it can't in some other situations where it's applied element-wise. This still doesn't make great use of cache and I do have some special code working for floats that does much better with a tiling pattern, but I wanted to improve +˝ for integers along with it and haven't finished those (widening on overflow is complicated).
mlochbaum commented on Blazing Matrix Products   panadestein.github.io/blo... · Posted by u/Bogdanp
bee_rider · 2 months ago
Does BQN just natively vectorize the code? I was surprised not to see anything about that.
mlochbaum · 2 months ago
The relevant operations for matrix multiply are leading-axis extension, shown near the end of [0], and Insert +˝ shown in [1]. Both for floats; the leading-axis operation is × but it's the same speed as + with floating-point SIMD. We don't handle these all that well, with needless copying in × and a lot of per-row overhead in +˝, but of course it's way better than scalar evaluation.

[0] https://mlochbaum.github.io/bencharray/pages/arith.html

[1] https://mlochbaum.github.io/bencharray/pages/fold.html

mlochbaum commented on Klong: A Simple Array Language   t3x.org/klong/... · Posted by u/tosh
etbebl · 2 months ago
I mean, sure, why not, and I'm not opposed to using array languages as a fun hobby (which seems to be the spirit of this). I just noticed that the selling points in the introduction to the manual were not very compelling to me as a Matlab/Numpy user, and since sometimes people bemoan that array languages aren't more widely used, I just wanted to say, hey we do have powerful "array languages" that imo are strictly better on things that matter for most real work, so it's not surprising.
mlochbaum · 2 months ago
To be clear, you are referring to the preface to "An Introduction to Array Programming in Klong", right? Having just checked it, I find this to be a very strange angle of attack, because that section is almost exclusively about why the syntax in particular is important. Obviously you disagree (I also think the syntax is overblown, and wish more writing focused on APL's semantic advantages over other array-oriented languages). I think this is a simple difference in taste and there's no need to reach so far for another explanation.
mlochbaum commented on Klong: A Simple Array Language   t3x.org/klong/... · Posted by u/tosh
etbebl · 2 months ago
I understand that these languages are older; I meant that in the sense that they are nonetheless still trying to recruit new users, but these potential users may already be using something that does something similar.
mlochbaum · 2 months ago
Oddly enough, the biggest mistake in how I presented BQN early on was thinking only APL insiders would be interested, when in fact the APLers went back to APL and people who hadn't tried other array languages or hadn't gotten far with them were were most successful with BQN. Plenty of people coming to BQN have worked with Numpy or whatever, but I don't think this has the same deterrent effect; they see BQN as different enough to be worth learning. Julia in particular is very different: I don't find that it culturally emphasizes array programming at all.
mlochbaum commented on Klong: A Simple Array Language   t3x.org/klong/... · Posted by u/tosh
thomasmg · 2 months ago
Thanks! So here is an explanation:

> The same baseless accusations of “unreadable”, “write-only” and “impossible to learn” are leveled at all Iversonian languages, k included.

I argue that these accusations are far from baseless. Sure, I can not cite a study, but neither does he. So I assume it's word against word.

> Readability is a property of the reader, not the language.

In my view this is an oversimplification. Having a steep learning curve clearly prevents adoption. The language design actively contributes to the problem. I'm just not sure on why. Could it be that the authors of these languages do not _want_ them to be used by others?

mlochbaum · 2 months ago
Search for "teaching" at https://aplwiki.com/wiki/APL_conference. I count at least five papers about teaching non-APL topics using APL. The language is not only possible to read, it's designed for it.
mlochbaum commented on Klong: A Simple Array Language   t3x.org/klong/... · Posted by u/tosh
etbebl · 2 months ago
I wonder how much overlap there is between users of array languages and of scientific programming languages/dialects like MATLAB, Numpy, and Julia, which are also optimized to operate over arrays. In other words, do K/Klong/whatever proponents realize that there is already a huge community of people who appreciate and utilize powerful operations on arrays to do real work, but just prefer to write something like "max(diff(x))" instead of "|/--:'x"? It's almost the same number of characters and it doesn't require learning a new writing system.
mlochbaum · 2 months ago
"already": APL dates back to about 1966, and even K from 1993 predates Numpy and Julia. But yes, we do not live in caves and are familiar with these languages. Klong has even been implemented in Numpy, see https://github.com/briangu/klongpy.

u/mlochbaum

KarmaCake day1266July 1, 2016View Original