How can I view the minimal required arguments of a Wolfram Language function?

How can I view the minimal required arguments of a Wolfram Language function?



This question might be a bit of an overstretch, or really obvious, but I haven't been able to find an answer yet.



Is there a way to automatically view the minimum required arguments for a WL function? For example, Sin only requires 1 argument, while Replace requires both an expression and the list of rules. Is there a way that, for example, I can input Sin into a function, and get back something like Real, or enter Replace, and get back Expression, Rules?


Sin


Replace


Sin


Real


Replace


Expression, Rules



I hope this makes sense - I would like to be able to automate input to any function in Mathematica, by being given the required arguments.



Thanks!





$begingroup$
Is there a way to automatically view the minimum You might be able to parse it out from the output of Information[functionName], It will list all the different signatures of the function there, one per line.
$endgroup$
– Nasser
Sep 11 '18 at 21:31



Is there a way to automatically view the minimum


Information[functionName]





$begingroup$
That's a good idea, however, when I try val = Information[Replace], and then view the results with ?val, it returns that val = Null
$endgroup$
– Jmeeks29ig
Sep 11 '18 at 21:55





$begingroup$
@Jmeeks29ig Information has side effects and doesn't return anything. Fortunately we can scrape the side effects with Block[CellPrint = Sow, Reap[Information[Replace]][[-1, 1]]]. However Replace::usage would be an easier way to see the information your after.
$endgroup$
– Chip Hurst
Sep 12 '18 at 12:47



Information


Block[CellPrint = Sow, Reap[Information[Replace]][[-1, 1]]]


Replace::usage





$begingroup$
Great, thanks! I hadn't known that was possible
$endgroup$
– Jmeeks29ig
Sep 12 '18 at 19:56




1 Answer
1



You can use SyntaxInformation:


SyntaxInformation


SyntaxInformation /@ Sin, Replace // Column



enter image description here





$begingroup$
It works - thanks!!!
$endgroup$
– Jmeeks29ig
Sep 11 '18 at 22:48






$begingroup$
@Jmeeks29ig, you are most welcome.
$endgroup$
– kglr
Sep 11 '18 at 22:56



Thanks for contributing an answer to Mathematica Stack Exchange!



But avoid



Use MathJax to format equations. MathJax reference.



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)