Use patterns that are built out of alternatives (look up Alternatives in
Help). Here is how this works in your example:
ab[r : (_Integer | _Rational), s : (_Integer | _Rational)] := r/s;
Stephen Luttrell
West Malvern, UK
<ahallam at iastate.edu> wrote in message news:fro39q$i8a$1 at smc.vnet.net...
>I would like to use Or in the function definition as in
>
> ab[ Or[r_Integer,r_Rational], Or[s_Integer,s_Rational] ]:=r/s;
>
> In other words, I want the function to take integers or ratios of
> integers as arguments, but not real numbers which are not rational.
>
> But if I give the function integer arguments, it does not evaluate.
>
> If I try
>
> ar[ r_Integer , Or[s_Integer , s_Rational]] := r/s;
>
> and give an integer first argument it works and so on.
>