Hacker News new | ask | show | jobs
by ChrisRackauckas 2674 days ago
Why metaprogram? Just define an operator using the built in kron function. Example:

const ⊗ = kron

A = rand(5,5)

B = rand(3,3)

A ⊗ B

Tada! I'm not sure how MATLAB/Octave's kron(A,B) looks more like math than A⊗B, but everyone can have their own opinion.

1 comments

Oh. For the benefit of others reading this comment thread, this is why that works: https://docs.julialang.org/en/v1/manual/variables/#Allowed-V...

This is the second time I've learned about time-saving functionality related to infix that I didn't know about. (The previous was the symbol for integer division, which had been left out of the documentation until version 0.7). In this second case, interpretation of Unicode symbols as infix operators should be better surfaced in Julia documentation and tutorials - it's a really useful feature.