Message Boards Message Boards

4 Replies
7 Total Likes
View groups...
Share this post:

#, {}, &/@ and other strange syntaxes

Posted 11 years ago

I was reading the Wolfram Demonstrations Source Code from I see many stranges commands and I would like to know where could I learn  them. I typed bellow part of the CDF file. Could you help me?
.....If[Flatten[#]=={},{}, Point[{#,Function[x,a3 x^3+a2 x^2+a1 x+a0][#]}]&/@{x/.#}]&[{ToRules[Quiet@Reduce[a3 x^3+a2 x^2+a1 x+a0==0,Reals]]}],.....
Thank you,
POSTED BY: Ana Squadri
4 Replies
Beginning documentation on most of these "runic forms" is available through "?".
When used in the Mathematica Front End, there is a blue >> that links to the
main reference page on the item.

 In[1]:= ? &                                                                            
 Function[body] or body &
        is a pure function. The formal parameters are # (or #1), #2, etc.
 Function[x, body] is a pure function with a single formal parameter x.
 Function[{x1 , x2 , …}, body]
       is a pure function with a list of formal parameters.
 In[2]:= ? /.                                                                           
expr /. rules  applies a rule or list of rules in an attempt to transform each subpart of
     an expression expr.

In[3]:= ? /@                                                                           
Map[f, expr] or f/@expr applies f to each element on the first level in expr.
       Map[f, expr, levelspec] applies f to parts of expr specified by levelspec.
POSTED BY: Bruce Miller
Posted 11 years ago
In Mathematica help

For # and & look up Function
For /. look up ReplaceAll
For @ look up Prefix
For {} look up List

There are lots of other one or two character aliases for other Mathematica functions and it can take some practice to recognize those.

There are also the issues of determining exactly what is and is not included when a function, that uses [ and ] to show you what is included, is turned into an operator where it may not be nearly as clear. This brings in all the issues of precedence. It is possible to use ( and ) to make it clear what is included, but this is often not done.
POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract