2 ms·
I haven't dipped into Julia's macro side, but I wonder how much work it would be to just create macros to create syntactic sugar that maps infix Kronecker produ
by ummonk 8y ago
I haven't dipped into Julia's macro side, but I wonder how much work it would be to just create macros to create syntactic sugar that maps infix Kronecker products to the Kronecker function.
There are so many Julia packages that do similar stuff that I imagine it can't be all that hard for people who have become fluent with the macro system.
- ChrisRackauckas 8y agoWhy 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.
- ummonk 8y agoOh. For the benefit of others reading this comment thread, this is why that works: https://docs.julialang.org/en/v1/manual/variables/#Allowed-Variable-Names-1 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.