Comment by tosh
2 days ago
you don't have to represent everything with arrays (k has arrays, dicts, tables, lists)
that said: finding array representations and transformations is usually a great idea for clarity and performance
many problem domains can collapse unnecessary abstractions down to the metal, but many languages and ecosystems make it difficult to "see" when that is the case
array languages have a way of nudging you into fewer abstractions and modeling things in dense arrays where applicable, and you will be surprised how often that is applicable
implementations can be highly efficient and will often make use of SIMD (and other optimizations)
in many cases an idiomatic, simple array language program will beat a naive solution written in C
BQN documentation has a great read on why
https://mlochbaum.github.io/BQN/implementation/versusc.html
the gist is writing in an array language helps because the interpreter has an easier time mapping high level array transformation concepts to optimized vectorized kernels than a C or C++ compiler looking at algol-like code
No comments yet
Contribute on Hacker News ↗