Hacker News new | ask | show | jobs
by upghost 615 days ago
God bless, my hat goes off to you sir. I have trouble wrapping my head around the concept of first class functions in ndarrays, let alone implementing it in hardcore APL. That has to be a feat on par with Hsu's Co-Dfns.

Don't suppose you can point to any resources to help wrap your head around BQN, do you?

1 comments

Well this is pretty much the goal of the BQN website so my best attempts are there. I might point to the quick start page https://mlochbaum.github.io/BQN/doc/quick.html as a way to feel more comfortable with the syntax right away. And the community page https://mlochbaum.github.io/BQN/community/index.html collects links by others; Sylvia's blog in particular focuses on the sorts of flat array techniques that are useful for a compiler.
While I've seen BQN mentioned previously on pages that discuss APL, K & J I finally took a look at it.

I've got to say, it's a really impressive language. Very well thought through, it brings some nice ideas. And as someone still newer to the space, it seems to do a great job of eliminating some of the unnecessary complexity of other languages. The straightforward approach on syntax / parsing is really fresh air.

Just looked at the github -- wait, you wrote BQN? My God. Is there any prior art on this -- arraylangs with first class functions? I don't think very many people realize how incredible the semantic power of BQN is. The idea of an arraylang with first class functions... it truly staggers the imagination.

I feel like if I were able to wrap my head around it I would never want to code in anything else. Thanks again and excited to take another look at it!

K, for a start. Whitney's earlier dialect A+ too. See https://aplwiki.com/wiki/First-class_function .
Don't most array languages have first class functions?
They have functions but not first class functions. Think (the ability to make) a vector/matrix of functions rather than just numbers :O

What could you do with that?

I don't know, but I bet some pretty cool stuff.

> What could you do with that?

Just a couple quick ideas:

    fns ← f g h         ⍝ array of function

    fns[condition] args ⍝ select function to run
    (3 0 0⌿fns)    args ⍝ f f f args