9
$\begingroup$

Is it possible to collect all inputs programmatically from every function in the Documentation Center in a list and wrap them in a HoldComplete?

My case: With some fundamental functions modified, I would like run a test of all functions to see what function will fail to execute.

$\endgroup$
  • $\begingroup$ Use NotebookImport on Documentation directory restricting it to InputCells. It is quite slow but you only have to do it once. $\endgroup$ – Kuba Jul 9 '16 at 9:35
  • $\begingroup$ keep in mind that some examples are meant to fail to show some issues or are just Messages related. $\endgroup$ – Kuba Jul 9 '16 at 9:36
  • $\begingroup$ @Kuba thanks for the hint. In this case I may try to avoid importing the inputs from "possible issues", etc $\endgroup$ – vapor Jul 9 '16 at 9:38
  • $\begingroup$ You can but I bet it is not the only section where messages are generated. $\endgroup$ – Kuba Jul 9 '16 at 9:39
13
$\begingroup$

You may use the "DocumentationExampleInputs" property of the "WolframLanguageSymbol" entity or WolframLanguageData function.

With "WolframLanguageSymbol" entity:

EntityValue[Entity["WolframLanguageSymbol", "Round"], "DocumentationExampleInputs"]

For more than one at a time you can use "EntityAssociation" to have the entities as keys.

EntityValue[RandomEntity["WolframLanguageSymbol", 2], "DocumentationExampleInputs", 
   "EntityAssociation"]

Similarly for WolframLanguageData function:

WolframLanguageData["Round", "DocumentationExampleInputs"]

Getting all may take a few moments to download.

EntityValue[WolframLanguageData[], "DocumentationExampleInputs", 
       "EntityAssociation"]

Hope this helps.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! This is a lot more easier than extracting by hand. $\endgroup$ – vapor Jul 9 '16 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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