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