omorr wrote:Based on the previous comments, I tried to present an oversimplified idea about how to make some kind of user defind functions.
Radovan,
I think what you have described above would be a great and very useful implementation of custom functions.
Since you have taken it in hand to present how you would visualize the implementation of custom functions, I thought I might present what I had been thinking as well. (only as another possibility)
I was thinking in the same general direction as you, but tried to visualize a solution using dialog boxes. Also, I would like custom functions to have the look and feel of built-in Smath functions.
So, lets say that you start by creating the Smath worksheet you showed us above (sorry for borrowing your image
) (The syntax of the file could help to designate the arguments and return values as you have shown in the image):
then, you would click on a menu choice "Define Func..." in the "Tools" menu:
This will display a dialog box allowing you to define the custom function either using the currently active Smath file or browse for another one on your local machine. In this case, we would choose "Use Active SMath Worksheet"...
At this point, I envision that Smath would analyze the Smath file to attempt to automatically locate the input variables and the return value. This would then be displayed in a dialog box that would allow the user to type in the function name, description, browse for an image showing sample usage, and then edit the input and output values (this could be done by either changing/deleting variables in the dialog box or simply cancelling the operation and returning to the defining Smath worksheet to rewrite using the correct syntax). The dialog box could possibly look like this:
Thus, the custom function would be available from the list of built-in functions within Smath (within a cateory called "Custom" ) :
This function would look and feel like a native Smath function. If custom functions are used within a Smath worksheet, the function could be merged with the Smath file, allowing it to travel with the file. If a user opened a file that contained the custom function, the function could be automatically added to the list of functions on that users system (or the user could be prompted whether they wanted this done or not).
Anyway, this is not necessarily the way this functionality should be implemented (if it is implemented at all). But just what I envisioned in my mind's eye. I submit it only as an idea and subject to change and improvement. Radovan, what you have written above is equally useful. Hopefully, Andrey can give us his opinion on what he thinks is practical, possible, or more user friendly, and the user community can give more input on whether they think this functionality is something they would want.
Edited by user 16 March 2010 02:57:39(UTC)
| Reason: Not specified