Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I would like to be able to use Mathematica's string completion feature for subvalues of my own functions. I tend to go for functions that follow the pattern f["description"][parameters][variables] So say I have functions describing models:

modelOfSomething["Linear"][a_, b_][x_]:= a + b x;
modelOfSomething["Logarithmic"][a_, b_][x_]:= a + b Log[x];

Then as time goes on, I define more functions:

modelOfSomething["NonLinear"][a_, b_, c_, n_][x_] := 
  modelOfSomething["Linear"][a, b][x] + c x^n;

so as I go along, I may end up with a few different models that I find useful to index with a string especially if they have the same number of parameters. So my question is

if/how can I get Mathematica to give me a drop-down of all the string subvalues of my function much like it does with CountryData:

enter image description here

share|improve this question

marked as duplicate by WReach, gpap, belisarius, RunnyKine, bobthechemist Aug 28 at 16:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

The method described in File-name completion for custom functions can be used to complete the "description" argument in your examples, but it won't work for the curried parameters and variables.

Note that the method does not appear to support dynamic computation of completion choices, so it cannot be used to generate the list directly from a symbol's definitions. The list would have to be maintained independently of the definitions themselves.

share|improve this answer
    
See, the linked is exactly the question I was looking for before I posted but I thought "string completion" was the right search term - I will see what I can do with it and if it is as easy as your answer there makes it look, I will delete this as duplicate. Thanks! –  gpap Aug 28 at 14:51
    
Let's close it instead of deleting it -- you won't be the last person to use that search term. –  WReach Aug 28 at 14:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.