# Recall the names of functions used in a long MMA code

Suppose you have a very long code in which many new functions are created. For efficient programming, very short and easily iterated function names are preferred.

For example,

runningFast[x_]:=x^2


can be named as

rf[x_]:=x^2


Obviously, the latter function rf[] is preferable in such example as:

k[y_]:=rf[x]^3+Sqrt[rf[x]]+Log[rf[x]]+...


because it is easy to write. However, if I come back to the same function later on, I might not remember what rf[x] does.

Question

Given a notebook, is there any way to keep track the function names with some explanatory note so that I can recall the names at will?

• If you expect to modify/maintain something you have written later on, "because it is easy to write" ranks quite low on the list of reasons to pick a function name. More so if your memory is not the best. – J. M. will be back soon Oct 9 '18 at 16:30

Set a usage message

rf::usage = "rf[x] is short for runningFast[x]";


when you type rf you can click the help button that pops up as you type, or evaluate

?rf


to get the usage message.

A tip from @m_goldberg in the comments is to put the usage statements in initialization cells in an auxiliary notebook, and include that notebook in your working notebook with a call to Needs.

• Yes, it is an answer to my question. I wonder if there is any way to keep all of the usage messages in a separate notebook linked to the notebook where they are created. The reason is that I like to have an uncluttered notebook (without explanatory notes) and retrieve the names not as single elements but retrieve the entire notebook where the names are stored like a separate window open when I create other names.. – Tugrul Temel Oct 9 '18 at 16:29
• @TugrulTemel. You can put the the usage message definitions in an auxiliary notebook. Make all the definition cells initialization cells. Put a Needs function call at beginning of you working notebook to load the messages. Make the cell with the Needs call an initialization cell as well. – m_goldberg Oct 10 '18 at 2:33
• @m_goldberg: Thanks for the very useful piece of information. I want to accept your comment as an answer, how can I do that? – Tugrul Temel Oct 10 '18 at 10:32
• @TugrulTemel. You can't accept a comment, but you can accept the the answer it is attached to, which is what I recommend. I made my remarks a comment so as not to set up a rival answer to this one. – m_goldberg Oct 10 '18 at 14:29