Well, it won’t hurt to read the manual, at least the parts related to the argument passing conventions, type system, dispatch, handling of the arrays, numerical computing, performance tips and style guide. That may eliminate a large fraction of questions to begin with. It’s not a huge read, should take maybe a day or two.
Now, if you need to restrict the dimensions, the best way is to use StaticArrays.jl package. It provides array types with sizes encoded in signature. Using them must also improve performance as the standard arrays aren’t optimized for small sizes (see also this topic).
Style-wise, return nothing
isn’t very Julian. If you look at the standard library functions, very small fraction of them uses nothing
as the return value, even those with the main purpose of mutation (e.g. push!
or copy!
or sort!
) return something return something that can be immediately used. In your case, return beta
is the obvious choice.
Regarding a confusion from defining multiple methods and getting (or not getting) errors because the call dispatched to a stale (from your viewpoint) method. Consider Pluto.jl for prototyping. It is designed around the idea that there must not be any hidden state beside what is visible in the notebook (i.e. if you delete a method, it automagically starts a fresh process where that method is not defined). Or use Revise.jl which also keeps method tables consistent with what’s written in your source files.