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"?


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

  • $\begingroup$ I can't answer the autocomplete question, but do you want a mechanism for automatically updating the properties list? $\endgroup$
    – rcollyer
    Jun 25, 2013 at 18:56
  • $\begingroup$ @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? $\endgroup$ Jun 25, 2013 at 19:00
  • $\begingroup$ 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. $\endgroup$
    – rcollyer
    Jun 25, 2013 at 19:11
  • $\begingroup$ Ah for this case I've added the Keys function from this answer to my toolchain. $\endgroup$ Jun 25, 2013 at 19:29
  • $\begingroup$ Well, that is far and away superior to my ad hoc solution. I may have to expropriate it ... :) $\endgroup$
    – rcollyer
    Jun 25, 2013 at 19:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.