TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

BQN: An APL Variant from Marshall Lochbaum

60 pointsby chrispsnalmost 5 years ago

6 comments

mlochbaumalmost 5 years ago
That&#x27;s me! It&#x27;s a pretty exciting time for BQN because I&#x27;ve just put the self-hosted version online where you can try it out. In addition to exploring a lot of new APL ideas[0], BQN is also a test of the Co-dfns[1] approach to compilation, meaning that with an appropriate runtime the entire bytecode compiler could be run in parallel on a GPU. It&#x27;s still in proof-of-concept stage, so that the online compiler is very slow and one running on dzaima&#x2F;BQN, another implementation, compiles only about as fast as Go despite having a lot less features. However, having written several thousand lines of BQN I&#x27;m very happy with the language&#x27;s fundamentals, and I feel it&#x27;s a big advance over APL or J.<p>[0] <a href="https:&#x2F;&#x2F;mlochbaum.github.io&#x2F;BQN&#x2F;doc&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;mlochbaum.github.io&#x2F;BQN&#x2F;doc&#x2F;index.html</a><p>[1] <a href="https:&#x2F;&#x2F;mlochbaum.github.io&#x2F;BQN&#x2F;implementation&#x2F;codfns.html" rel="nofollow">https:&#x2F;&#x2F;mlochbaum.github.io&#x2F;BQN&#x2F;implementation&#x2F;codfns.html</a>
评论 #24172809 未加载
评论 #24172488 未加载
评论 #24176581 未加载
评论 #24177259 未加载
评论 #24172536 未加载
mncharityalmost 5 years ago
&gt; The Javascript-based compiler[1] is also slow [...] this is purely due to the slow runtime<p>Top-level functions are defined with &#x27;let&#x27;. I wonder if &#x27;const&#x27; is more likely to be inlined?<p>Array&#x27;s are given a flag property &#x27;sh&#x27;. I wonder if adding a property to an Array drops it off Array operation fast paths? Perhaps interferes with its optimization on element kinds?<p>Functions are given a flag property &#x27;m1&#x27; xor &#x27;m2&#x27;. So shape polymorphism, different hidden classes, and associated burden on inline caches at call sites, property accesses, etc. Better to always set both. I wonder if adding any property to a function drops it off function call fast paths? Or interferes with inlining? Perhaps these flags might be avoided using &#x27;Function.length&#x27;?<p>I wonder if there&#x27;s some low-hanging performance fruit here.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;mlochbaum&#x2F;BQN&#x2F;blob&#x2F;master&#x2F;docs&#x2F;bqn.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mlochbaum&#x2F;BQN&#x2F;blob&#x2F;master&#x2F;docs&#x2F;bqn.js</a>
评论 #24174305 未加载
7thaccountalmost 5 years ago
Hey Marshall,<p>Do you still work at Dyalog? Is this just a personal hobby project?<p>Why choose JS or Go as implementation languages if you&#x27;re already quite familiar with C? I guess web browser support is neat, but what I&#x27;ve always really wanted was a single executable (no install) that can run as a REPL or build self-contained executables that bundle the code and interpreter. I think that could be pretty useful. I know J exists, but it is a huge install.
评论 #24174995 未加载
mncharityalmost 5 years ago
A python or julia implementation, integrated with normal numpy, might enable low-barrier exploration and incremental adoption?
评论 #24174415 未加载
smabiealmost 5 years ago
Awesome work! Hopefully array languages will undergo a renaissance!<p>One thing is that even after reading running.md, I&#x27;m still kind of confused about how to actually run BQN. Maybe provide an easy way to get started with the self-hosted bytecode compiler? Or maybe there is an easy way, but I&#x27;m just stupid.
评论 #24174158 未加载
meigetsualmost 5 years ago
If you could get this to run fast on GPUs you might get some converts from other APL family languages.