3 ms·
One behavior I like about Matlab is that functions are functions. Arguments are passed by value and there's no way a function can modify its arguments (well, ex
by nimrody 7y ago
One behavior I like about Matlab is that functions are functions. Arguments are passed by value and there's no way a function can modify its arguments (well, except perhaps objects which are less common).
Matlab will try to optimize and avoid a copy if the function does not modify the argument. Matlab is also (sometimes) smart enough so that A=f(A) will modify A in place instead of making a copy.
This is what I expect from a math oriented language. Maintain the illusion of referential transparency but optimize under the hood if possible.
Also Matlab has a reasonable JIT compiler. And a good debugger.
I no longer use Matlab but it is a very productive environment for scientific computing (simulations, exploration).
- bobbylarrybobby 7y agoMany numpy functions have an `inplace` (or maybe there’s an underscore there?) argument that tells whether to perform the operation in place or return a new array.
- newen 7y agoIt's completely arbitrarily whether a numpy function or method modifies the array or not. No way to tell except documentation or trying it out.