mlochbaum•

Author here! Not too much to say that isn't on the website, but I'll be sticking around to answer questions.

A few recent happenings in the BQN world. I was recently a guest on this episode of the Array Cast, an array oriented podcast. Since then activity on the chat forum has really picked up, with somewhere around 20 active users discussing all sorts of things and complaining about how they don't have time to read it all. Come contribute! Finally, just Wednesday I finished up header handling in the compiler, which was the last really big syntax feature left. dzaima's still working to get some aspects of this running in CBQN, but now it feels like I can say the compiler implements BQN instead of just most of it.

19
Netzapper•

an array oriented podcast

Truly we live in bizarre times.

12
shponglespore•

It's a podcast where you're supposed to listen to all the episodes at the same time.

20
gopher9OP•

Relevant as never before. SIMD programming is array programming, as well as GPU programming. But for some reason, most of programming is stuck in the scalar world.

4
Netzapper•

Oh, no, I hear you on the relevance of the techniques. I work in GPU-accelerated HPC middleware, so I wish I could get my PhDs to adopt some array language.

Just commenting on the hyperspecific podcasts we get these days.

9
keepitsalty•

What would be an example of an array language? Would that be something like R that natively broadcasts functions across arrays?

2
Lucretia9•

Why is it called bqn and not bqm?

4
mlochbaum•

Well BQM is not a very good name so I certainly wouldn't have called it that. But I don't know the alphabet very well apparently so I found a good one.

3
[deleted]•

[deleted]

1
vanderZwan•

now it feels like I can say the compiler implements BQN instead of just most of it.

Congrats! How does it feel?

2
mlochbaum•

Pretty nice. BQN's getting to where instead of feeling like all sorts of things need urgent attention and they're all fighting against each other because I don't have the time, there are improvements I can make but I can just get to them whenever I'm ready. Having the documentation nearly complete (~5 pages to do now) is part of that too.

2
vanderZwan•

Glad to hear it! At the moment I'm just reading into array languages, not actually coding in any of them. I really enjoyed what I've read of the docs of BQN so far :)

1
pxeger_•

Didn't know there was such an overlap between r/PL and CGCC, hi!

2
yiyus•

Hi Marshall. Just wanted to tell you that I am very (positively) impressed with BQN. Really good work! I started diving into it just a few days before the podcast came out so it was the perfect timing.

I think I have already read all the available documentation (which is excellent too), and am starting to write little programs. BQN solves many issues I had with APL/J/K and implements some ideas I had also (vaguely) considered. Even after carefully reading the Problems page I am convinced the pros are more than the cons.

I've been lurking in the discord channel and I hope I can get a bit more of time at some point to actively collaborate. I also have some weird ideas I'd like to try in the longer term.

One short unimportant question: don't you think 'c' for characters is a waste? why not just 'c, or some other glyph so you have the quotes available? and by the way, do you have any plans for [ and ]? why not using those for lists instead of ⟨ ⟩?

2
mlochbaum•

The closing single quote is definitely unnecessary, and was chosen for familiarity (for anyone confused, this is because characters are exactly one character long; strings are delimited with "" and do need the closing one). I think that consideration is strong enough that I never did a serious evaluation of whether an unpaired version could work. The paired version is probably a little easier to read and could allow escape codes like '\n' in the future. I don't think needing an extra character in a literal is a great loss so this could outweight the benefit of brevity.

Square brackets [] are reserved for a higher-rank array notation, so that [a‿b, c‿d, e‿f] gives a shape 3‿2 matrix (each "element" here is a stranded list and they'd be merged together). I'm still a little wary of adding an element of syntax that needs to call a primitive, although I guess the matching in header destructuring also uses Match in this way. It also just looks awkward when the rows are ⟨⟩ lists. >⟨⟩ does the same thing and wouldn't look worse, but it also can't be used in destructuring assignment.

3
mlochbaum•

Since this is r/ProgrammingLanguages maybe I should highlight a feature that I think could be applied in all sorts of languages: character arithmetic. Here's the documentation, and a tutorial section that makes the connection to affine spaces in linear algebra.

The purest way to handle characters is just to make them a set of values with no character operations at all. If instead you want to give the programmer access to the Unicode ordering then I think arithmetic is the right way to do it. It allows the useful things like finding the distance between two characters or advancing a character by one but doesn't allow useless things like adding characters. The advantage over a C-like model where characters are just a kind of number is that the result type is always correctly determined when doing arithmetic: for example distances between characters are numbers and advancing a character still gives a character. This makes it much easier to use (no casting) even though C's model is in principle more flexible.

12
hopelesspostdoc•

As a Rustacean, let me say that I love this approach. I also like the 0/1 bools. Sometimes you just want a number, amirite?

I'm also really loving what I see of BQN so far. Still reading the docs, but it seems so well thought out.

I would like to request a doc page on writing code that isn't write-only, which is a common issue with APL. I don't know how to achieve this necessarily, but I would guess using more intermediate variables would help. Not sure.

1
mlochbaum•

I don't have any advice besides the descriptive names and comments you'd use in any language. For an example, I wrote (most of) md.bqn in a less dense style to show off easier-to-read BQN.

Frankly I don't think write-only code is much of a problem with array programming languages. The term gets brought up a lot by outsiders because "this language pushes you towards unreadability" sounds better than "I personally can't read this". So the best way to avoid write-only code is just to improve your reading skills. On the other hand, it is true that APL has a culture of individualism and quick-and-dirty experimentation and many APLers write code in a throw-away style even if they want to keep it. The problem here is a complete lack of care, and if you pay a little bit of attention to how your code reads, and occasionally revisit old code, you should be fine.

2
panic•

just wanted to say, incredible work with the tutorial. it's rare to find a tutorial that doesn't just explain how to use the language, but also why the language is that way, in a way that makes you think "huh, that does make a lot of sense"...

4
skyb0rg•

Nice, I’m excited to check this out.

One thing to note: the website has a lot of links, but it’s sometimes hard to get between them. For example I found a page for editor support on mobile, but couldn’t find it on my desktop for a while. May I suggest an Index page with all the page names and links?

1
mlochbaum•

For now you can browse around the Github repository, since the folder structure is the same and all the markdown files have links to the HTML pages at the top (the site generator enforces this). I could add a sitemap although my impression is that people rarely use these.

1
rpiirp•

I've always been interested in array languages and this seems to be the coolest in the APL family so far.

Would you be willing to consider an optional syntax that doesn't require special characters and uses keywords in ASCII instead? I know, that's horrible for you APL folks but think of people like me who still hasn't memorized the Greek alphabet after years of trying.

1
mlochbaum•

This is what Q does, and it has its fans. I think doing it in BQN would be reasonable, but I'm hesitant to design something I wouldn't actually use—and as I have plenty of other BQN things to work on "hesitant" translates to "it's not happening". I do hope that BQN will be able to give someone else the tools to design something like this. The compiler can run with a set of already-defined names (this is used for the interactive REPL), which is fine except for error messages.

I don't think BQN syntax is too well-suited for using mainly keywords. With keywords there's more room for syntax like parenthesized function calls which make the weird subject/function/modifier hierarchy unnecessary. So in a really word-oriented design you might end up using BQN's array primitives but not much else from the language.

2
gopher9OP•

You can define it yourself, like so: Flip ← ⍉ or _rank_ ← ⎉. But did you try flashcards, like Anki? They are very effective for memorizing things. I used Anki myself to learn both APL and BQN.

1
DriNeo•

You can give a look to another one-letter named language.

https://en.wikipedia.org/wiki/J\_(programming\_language)

1