%mathpiper,def="@"

Rulebase("@",{func,arg});
Rule("@",2,1,IsList(arg)) Apply(func,arg);
Rule("@",2,2,True       ) Apply(func,{arg});

%/mathpiper



%mathpiper_docs,name="@",categories="Operators"
*CMD @ --- apply a function
*STD
*CALL
	fn @ arglist
Precedence:
*EVAL PrecedenceGet("@")

*PARMS

{fn} -- function to apply

{arglist} -- single argument, or a list of arguments

*DESC

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.

This operator can help the user to program in the style of functional programming languages such as Miranda or Haskell.

*E.G.

In> "Sin" @ a
Result: Sin(a);
In> {{a},Sin(a)} @ a
Result: Sin(a);
In> "f" @ {a,b}
Result: f(a,b);

*SEE Apply
%/mathpiper_docs
