Meet Stencila Functions
Let’s assume you are editing a spreadsheet and entering a cell expression (Mini). Now just type the function call as it were already defined. When the cursor is over the function name you’ll see a prompt that let’s you create a new function definition.
This would already reason about the given arguments and prefill the function signature accordingly.
We show the function editor in a modal dialog, where you can choose the implementation language, adjust the signature and write the source code. On confirmation the dialog would close and you’d see the results of your expression ran through your custom function.
The same would work from within Documents, when you could call custom functions in your code cells.
We believe that sharing methods in research becomes more and more important. By giving algorithms a (function) name and documenting their usage they become reusable. We hope that in the future scientists could cite or even call a function x of publication y.
However that’s for the future. For now I’d just want to know from you how you would use such a feature. I’m also interested in evaluating whether creating a set of custom functions and gluing them together could be used as an alternative to the Notebook paradigm (e.g. Jupyter, RMarkdown) where source code is written inline and run in a global execution context. The beauty of the function abstraction would be that users can define functions in different languages and compose them in arbitrary ways. It’s also nice to provide the reader a high level view on your research methods, rather than just showing them the code straight away. Source code can get pretty complicated to read, while simple Excel-like expressions give you a good overview. For instance your document could look like this:
I’ve written an article earlier this year which sketches some of the ideas we are now hoping to improve on and implement in Stencila.
Let us know what you think!