1. I use PolishNotation for the names of functions and alllowercase for variable names. (Underscores are unfortunately illegal.)
2. Every function's variable names end in one common number, e.g. variable23 and x23, because MathKernel makes it a huge pain to declare local variables, so I have to manually prevent naming collisions. Yuck.
3. I try to use builtin functions when I'm aware of them, for the sake of speed and brevity. So Google function names which are unfamiliar to you.
4. When you enter commands, pay close attention to any terminating ";" character. If you omit it, then MathKernel will display the output, which could be annoying if you're generating a massive data structure. When entering function declarations, however, this character is unnecessary.
5. I use the "list" suffix to refer to a list of items. Similarly, "listlist" refers to a list of lists, etc.
6. Most function names end in "Get" because they are purely functional, and thus return data without conducting IO. IO functions would terminate with other verbs, e.g. "Print".
7. Linux terminal users: when you cut-and-paste from this blog into MathKernel, highlight the text and press Ctrl+C. Then paste into into the terminal by clicking on the terminal window, pressing the "right click menu" button (usually just to the right of the space bar on a standard PC keyboard), and hitting "p" for "Paste". This works in most but not all terminal contexts.
No comments:
Post a Comment