https://www.arraycast.com/episodes/episode111-ideal-array-la...
It can be faster than Fortran based library that is still being used by Matlab, Rust and Julia [1].
It will be interesting to compare Mojo moblas BLAS library with GLAS library performance in D.
[1] Numeric age for D: Mir GLAS is faster than OpenBLAS and Eigen (2016):
http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/...
Taking examples I am familiar w/, it is key that you can add a scalar 1 to a rank 2 array in numpy/matllab without having to explicitly create a rank 2 array of 1s, and numpy somehow generalizes that (broadcasting). I understand other array programming languages have more advanced/generic versions of broadcasting, but I am not super familiar w/ them
⊢×0≠∧˝˘∧⌜∧˝ # Marshall & Dzaima (tacit!)
(≠⥊∧´)˘{×(⌾⍉∧)0≠} # Dzaima & Rampoina
{×(∧˝˘∧≢⥊∧˝)0≠} # Dzaima
Call me old fashioned and stuck in C style syntax but I can't imagine anyone describing this as beautiful art.And a comfortable APL is clearly an oxymoron.
He created it intending to be +1 of APL. Accidentally came up with BQN instead of BQM. Sat with that for 1hr, really liked the name, then realized that it should be BQM which he hated, so he stuck with BQN.
That said, it's and incredibly designed language. I honestly have never read any language (especially not designed by a single person) with the level of creative thought as he put into BQN. Some really incredible insights and deep understanding. It's amazing reading his posts / documentation about it. The focus on ergonomics, brand new constructs and the consistency/coherence of how all of his decisions fit together is really impressive.
The double-struck characters have disappeared from the second and third lines creating a fun puzzle. Original post https://www.ashermancinelli.com/csblog/2022-5-2-BQN-reflecti... has the answers.
Think about using matrix to describe geometric transformations instead of using standard functions.
[ cos(θ) -sin(θ) 0 0 ]
[ sin(θ) cos(θ) 0 0 ]
[ 0 0 1 0 ]
[ 0 0 0 1 ]So "rank polymorphism" means being able to write expressions that work correctly regardless of how many dims the arrays involved have.
For example, in numpy you can write a function that handles both lists and matrices automatically, by taking advantage of broadcasting. (The J language takes this idea a lot further -- numpy is a fairly minimal implementation of the idea.)
User-Extensible Rank Polymorphism is just beautiful with the broadcast dot syntax. I don't think any other language has this clean and flexible implementation.
Others -- GPU programing, parallelism, etc. are pretty good with Julia. Real shame it hasn't taken off.
Just to be clear, I guess that Julia's broadcast (dot) syntax is an implementation of "User-Extensible Rank Polymorphism"; is that right? Or does Julia's dot syntax include more than UERP?
https://juliahub.com/industries/case-studies
Many languages could dream to have even a third of such high profile case studies.
I like to play with it, but just it.
See https://github.com/llvm/llvm-project/blob/main/flang/docs/Ar....
abcd_f•6mo ago
> IMO this is what makes something an array language.
Great to hear. So what is it?
preommr•6mo ago
goldenCeasar•6mo ago
CraigJPerry•6mo ago
If i'm reading the syntax correctly, this would translate in kdb/q to a raze (flatten) on the 3 dimensions (regions, offices, employees). Probably more likely to be expressed as a converge but in either case, the calculations here are not possible in a rank polymorphic way.
goldenCeasar•6mo ago
This is from a Ruby DSL I'm working on (Kumi). Probably the broadcasting semantics are very different from traditional rank operators in q/APL?
Edit: I realized that I missed the input structure:
CraigJPerry•6mo ago
goldenCeasar•6mo ago
npalli•6mo ago
djoldman•6mo ago
Example 1: A function that can take as input a 4x2x8 matrix or a 3x7 matrix.
Example 2: A function that can take as input a 4x2x8 matrix and a 3x7 matrix and output a third matrix.
almostgotcaught•6mo ago
which shows that this feature request is complete jibberish
rscho•6mo ago
tracker1•6mo ago
taeric•6mo ago
tracker1•6mo ago
taeric•6mo ago
tracker1•6mo ago
tomsmeding•6mo ago
If rank polymorphism results in accepting both 4x2x8 and 3x7, then that means the function was a function on elements to begin with. Which is possible, but not the most interesting application of rank polymorphism.
djoldman•6mo ago
Thanks, this is what I was ineloquently attempting to describe with "A function that can take as input a 4x2x8 matrix or a 3x7 matrix."
CapsAdmin•6mo ago
There are other cases like adding vectors to matrices and so on, but in the end this logic is defined in some custom add operator overload on a class or object in the language.
(I had no idea what it meant either until i searched for examples..)
cl3misch•6mo ago
> Numpy also needs to be paired with a JIT compiler to make python a real array language