mlochbaum / BQN

An APL-like programming language

Home Page:https://mlochbaum.github.io/BQN/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about reshape

andrewnc opened this issue · comments

In APL I would write something like 3 4 ⍴ ⍳12 to get a 3x4 array of values from 1 - 12. In J it would be something like 3 4 $ i. 12 (which would give 0 - 11)

In BQN, I assumed it would work similarly 3 4 ⥊ ↕ 12 but I must be doing something incorrect. I have tried a number of blocking for presidence, but nothing quite works.

Anyway, I'd love to know what I'm missing. I'm loving bacon so far :)

In BQN array constants don't work like in APL - values side by side don't mean anything special (so you can write 2⊸+⍟5 3 (add 2 to 3, 5 times - 2∘+⍣5⊢ 3 in APL)).

Rather, you must write 3‿4 ⥊ ↕12 or ⟨3,4⟩ ⥊ ↕12.

Oh, of course! How silly. I remembered that for various right arguments.

Lovely, thank you