0
$\begingroup$

Shorthand syntax provides an alternate way to apply functions and, in many cases, improves readability. A simple example would be

 In[1]:=  numList = {1, 0, 1, 1, 0, 1, 1};
 In[2]:=  FromDigits@numList
Out[2]:=  1011011

instead of

 In[3]:=  FromDigits[numList]
Out[3]:=  1011011

Here, the syntax is simply <function> @ <argument>. (There is also the weaker suffix <argument> // <function>.) For lists, more sophisticated methods of applying functions exist (Map, Apply, etc), some with their own shorthands (/@, @@).

Many built-in functions accept parameters and options in addition to arguments. For example, one can specify which base to use for FromDigits:

 In[4]:=  FromDigits[numList, 2]
Out[4]:=  91

How do you incorporate function parameters/options into shorthand syntax?

EDIT: After more searching of Mathematica Stack Exchange, I found this answer by Brett Champion to this question. I believe it answers my question.

$\endgroup$
2
  • $\begingroup$ @Sektor Yep, I included it in my edit when I found it. What's the SE policy here? Should I go ahead and delete this question? $\endgroup$
    – higgy
    Jan 8, 2014 at 20:50
  • $\begingroup$ If you wish, but I think the more appropriate thing to do is leave it so It can be locked - this way even though it is locked new users will find what they are looking for easily :) $\endgroup$
    – Sektor
    Jan 8, 2014 at 20:51

0

Browse other questions tagged or ask your own question.