: , @ , /@ , .. .

Functional operators

These operators can help the user to program in the style of functional programming languages like Miranda and Haskell.

: Prepend item to list, or concatenate strings
@ Apply a function
/@ Apply a function to all entries in a list
.. Construct a list of consecutive integers


: -- Prepend item to list, or concatenate strings

Standard math library
Calling Sequence:
item : list (prec. 7)
string1 : string2 (prec. 7)
Parameters:
item - an item to be prepended to a list
list - a list
string1 - a string
string2 - a string
Description:
The first form prepends "item" as the first entry to the list "list". The second form concatenates the strings "string1" and "string2".
Examples:
In> a:b:c:{}
Out> {a,b,c};
In> "This":"Is":"A":"String"
Out> "ThisIsAString";
See Also:
Concat , ConcatStrings .


@ -- Apply a function

Standard math library
Calling Sequence:
fn @ arglist (prec. 60)
Parameters:
fn - function to apply
arglist - single argument, or a list of arguments
Description:
This function is a shorthand for Apply. It applies the function "fn" to the argument(s) in "arglist" and returns the result. The first parameter "fn" can either be a string containing the name of a function or a pure function.
Examples:
In> "Sin" @ a
Out> Sin(a);
In> {{a},Sin(a)} @ a
Out> Sin(a);
In> "f" @ {a,b}
Out> f(a,b);
See Also:
Apply .


/@ -- Apply a function to all entries in a list

Standard math library
Calling Sequence:
fn /@ list (prec. 60)
Parameters:
fn - function to apply
list - list of arguments
Description:
This function is a shorthand for MapSingle. It successively applies the function "fn" to all the entries in "list" and returns a list contains the results. The parameter "fn" can either be a string containing the name of a function or a pure function.
Examples:
In> "Sin" /@ {a,b}
Out> {Sin(a),Sin(b)};
In> {{a},Sin(a)*a} /@ {a,b}
Out> {Sin(a)*a,Sin(b)*b};
See Also:
MapSingle , Map , MapArgs .


.. -- Construct a list of consecutive integers

Standard math library
Calling Sequence:
n .. m (prec. 60)
Parameters:
n - integer. the first entry in the list
m - integer, the last entry in the list
Description:
This command returns the list "{n, n+1, n+2, ..., m}". If "m" is smaller than "n", the empty list is returned. Note that the .. operator should be surrounded by spaces to keep the parser happy, if "n" is a number. So one should write 1 .. 4 instead of 1..4.
Examples:
In> 1 .. 4
Out> {1,2,3,4};
See Also:
Table .