Skip to content

A comparison of array languages: APL, J, BQN, Q, Julia, R, NumPy, Nial, Futhark & SaC.

License

Notifications You must be signed in to change notification settings

athas/array-language-comparisons

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

General

Array Language Specific

Language / Library Websites

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

Comparisons

  1. REPL
  2. Index Base
  3. Length of Array (Leading Axis)
  4. Shape of Array
  5. 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

Other Comparisons

  1. Creating an Identity Matrix
  2. Creating an Iota Matrix
  3. Reversing a Matrix Row-wise and Column-wise

About

A comparison of array languages: APL, J, BQN, Q, Julia, R, NumPy, Nial, Futhark & SaC.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published