It is not uncommon for students to be assigned questions which they are required to complete "without using any built-in functions". There is not a great deal that can be programmed in MATLAB without using any built-in functions, but a little can be done -- but what, exactly is possible?
What a "built-in function" is, exactly, is open to interpretation. In the below, I refer instead to "publicly visible routines". Keywords (see below) are not publicly visible routines (they are "statements" or components of statements.) Any documented operation or call that invokes a MATLAB-supplied .m or .p or mex file or built-in library to do its work is a publicly visible routines. If you can use documented methods override the normal meaning of a statement or expression in practice by supplying alternate code, then the code probably involves publicly visible routines. If the language design is such that you could use documented methods to override the normal meaning of a statement or expression in theory (such as the behavior of adding two double, the code for which is in practice bundled into an internal MATLAB library), then I would still consider that a call to a publicly visible routine.
A MATLAB-supplied routine that is not documented, which is used for internal MATLAB purposes, could perhaps be held not to be a publicly visible routine, but it certainly would still be a "built-in function".
I exclude from the list any routine which there is no direct way to access, and is only used for internal purposes, such as the memory allocation routines.
This is what I have come up with:
I may have overlooked something due to shortage of chocolate in my bloodstream.
The language described above is not Turing complete, and is not "sufficiently powerful" for the purposes of the Church-Rosser Theorem of general-purpose computability. It is also not possible to do any arithmetic in it, as arithmetic must be reducible to the Peano Postulates, and those require at the very least the ability to compare a value for equality with 0, which in MATLAB would require a call to the MATLAB routine "eq".
No products are associated with this question.
5 Comments
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/38787#comment_80250
Does accessing the mex and java capabilities require any builtin functions?
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/38787#comment_80255
Good question, Daniel. I would say "No" for "mex", and "I am not sure" for java. "import" does not.
I will add a clarification above as to what a "builtin function is" for the discussion.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/38787#comment_80257
I was wrong, import() is a real routine.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/38787#comment_80259
Well if mex is okay, then I would say you can do a fair amount.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/38787#comment_80346
Hey, what's up? I've written a lot functions without the built-in ANY command.