# What does the ToList function do, and where did it go?

I am trying to revive some code from 2015 (version 10?) which uses the function ToList. I can not find it defined in any notebook on my system (in fact, it only appears in this one notebook). I had loaded the GeneralUtilities package in this notebook, so maybe ToList was defined in a previous version of that. From the context of its usage, it appears to force its arguments to be a list, but only if the argument is not already a list, like:

ToList[x_List] := x;
ToList[x__] := {x};


Does anybody remember this function?

• @AlbertRetey There it is. I don't recall using the developer package. Thanks for finding it. – Daniel W Apr 5 '18 at 21:37
• fwiw in 10.1 the symbol exists per ?DeveloperToList but remains unevaluated for any argument. – george2079 Apr 5 '18 at 21:52
• GeneralUtilitiesToList existed in 10.0 and 10.1, but was moved into the Developer context in 10.2. The GeneralUtilities version only accepted exactly one argument, but the Developer version accepts any number of arguments (including zero) and concatenates any explicit list arguments. – WReach Apr 5 '18 at 22:18
• Fun fact that doesn't really add anything to WReach's comment in practice: We can do GeneralUtilitiesPrintDefinitions[DeveloperToList] (see (1742)) to see that the current version of ToList has only one definition yet accepts arbitrarily many arguments (including zero). – jjc385 Apr 6 '18 at 9:42

The function is still there (version 11.3). It lives in the Developer context. If you don't know their context you can find functions with something like:

?*ToList


or if they are in deeper nested contexts (e.g. private ones) with:

?**To*


In that case the first one returns DeveloperToList. Of course that only works for those builtin symbols which are pre-loaded without an explict Get or Needs.

There is no documentation available, but some tests suggest that what you are guessing is correct:

DeveloperToList[x]


{x}

DeveloperToList[{x}]


{x}

DeveloperToList[{1,2,3}]


{1,2,3}

DeveloperToList[1,2,3]


{1,2,3}

• I'll let this stew for a few days and accept your answer. – Daniel W Apr 5 '18 at 21:39
• great, waiting for more answers is always a good idea... – Albert Retey Apr 5 '18 at 21:41
• Any idea what the purpose of this function is? In what case would it be used instead of, say, Apply[List,f[1,2,3]], or just List[1,2,3]? (the reason this is nonobvious is maybe why it's not a global symbol) – ktm Apr 5 '18 at 23:03
• @user6014 It might be useful in the implementation of functions like Max that take either a variable number of arguments (i.e., Max[1, 2, 3]) or a list of arguments (i.e., Max[{1, 2, 3}]). Pass the sequence of input arguments to ToList`, and then either way, you've got a list you can process. – David Zhang Apr 6 '18 at 4:45