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.

I'd like to assign DownValues to a symbol like this

x["firstvalue"] = 1;
x["secondvalue"] = 2;

And then have the DownValue keys "firstvalue" and "secondvalue" offered in an autocomplete list once I have entered x[.

Another useful application for this kind of modification is to have the "Properties" of an object like a FittedModel added to the autocomplete list. It is not always easy to remember "SinglePredictionConfidenceIntervalTableEntries", which is one of the 64 properties of FittedModel.

Can this be done? What controls the entries in the autocomplete "engine"?

Addendum

This amazing answer shows a way of altering the behavior of autocomplete. I do not yet understand how it works.

share|improve this question
    
I can't answer the autocomplete question, but do you want a mechanism for automatically updating the properties list? –  rcollyer Jun 25 '13 at 18:56
    
@rcollyer, I don't understand your question. I can always call thisFit["Properties"] to find the properties of the fit or DownValues[x][[All,1,1,1]] to get the keys of x. You have improvements upon these methods? –  ArgentoSapiens Jun 25 '13 at 19:00
    
Not on thisFit, obviously. But, DownValues[x][[All,1,1,1]] is stymied by fcn[] := . So, I've been using Case, but you have to get the pattern correct. –  rcollyer Jun 25 '13 at 19:11
    
Ah for this case I've added the Keys function from this answer to my toolchain. –  ArgentoSapiens Jun 25 '13 at 19:29
    
Well, that is far and away superior to my ad hoc solution. I may have to expropriate it ... :) –  rcollyer Jun 25 '13 at 19:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.