This is a collection of idioms and small programs in APL, J, BQN, Julia, R and NumPy.
There are several sites that do these kinds of comparisons:
Language | Main Website | Help / Docs | Online REPL | |
---|---|---|---|---|
💚 | Dyalog APL | dyalog.com | Dyalog Help | TryAPL |
💚 | J | jsoftware.com | J NuVoc | J Playground |
💚 | BQN | mlochbaum.github.io/BQN | BQN Docs | BQNPAD |
💚 | Q | code.kx.com/q | Q Ref | 🚫 |
💙 | Julia | julialang.org | Julia Docs | Replit |
💙 | NumPy* | numpy.org | NumPy Docs | Replit |
💙 | R | r-project.org | R Docs | JDoodle |
💜 | Nial | nial-array-language.org | Nial Dictionary | TIO |
💜 | Futhark | futhark-lang.org | Futhark Docs | 🚫 |
💜 | SaC | sac-home.org | SaC Docs | 🚫 |
* Library, not an actual language
- 💚 Main (APL-Family) Array Languages
- 💙 Main (Non-APL-Family) Array Languages
- 💜 Fringe Array Languages
- REPL
- Index Base
- Length of Array (Leading Axis)
- Shape of Array
- Number of Elements in Array
1 | 2 | 3 | 4 | 5 | |
---|---|---|---|---|---|
APL | 🟢 | 1 (or ⎕IO ) |
≢ |
⍴ |
×/⍴ |
J | 🟢 | 0 | # |
$ |
*/@$ |
BQN | 🟢 | 0 | ≠ |
≢ |
×´≢ |
Q | 🟡 | 0 | count |
🚫 | count raze |
Julia | 🟢 | 1 | size(a, 1) |
size(a) |
length(a) |
NumPy | 🟢 | 0 | len(a) |
a.shape |
a.size |
R | 🟢 | 1 | dim(a)[1] |
dim(a) |
length(a) |
Nial | 🟡 | 0 | first shape |
shape |
tally |
Futhark | 🟡 | 0 | length |
🚫 | flatten |> length |
SaC | 🚫 | 0 | shape(a)[0] |
shape(a) |
prod(shape(a)) |
🟡 Means the REPL has limitations
- Q REPL has no HOME, END, or any arrows (CTRL or not)
- Nial REPL has no CTRL left or right arrow
- Futhark REPL has no HOME, END, or DEL
If you are using Q, Nial, Futhark or other languages with REPL limitations, you can get around this by invoking with rlwrap
. On Linux using the Q REPL:
sudo apt install rlwrap
rlwrap taskset -c 0 ./q