MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Function argument types

  • To: mathgroup at
  • Subject: [mg112953] Re: Function argument types
  • From: Murray Eisenberg <murray at>
  • Date: Thu, 7 Oct 2010 03:37:58 -0400 (EDT)

One keyword would be PatternTest. A more general one would be "pattern".

Integer is not a function name, so that f[n_?Integer] := ... would never 
allow an integer argument to be accepted as such and thus allow f to be 
calculated using whatever followed the ":=".

On the other hand, Integer is a possible Head, as in


so that f[n_Integer]:= ... would accept an integer as such and proceed 
with applying the definition.

On 10/6/2010 3:16 AM, Sam Takoy wrote:
> Hi,
> I can't see to find the answer to this basic question:
> What's the difference between
> f[n_?Integer]:=
> and
> f[n_Integer]:=
> I would be happy to read more about this, but what's the keyword?
> Thanks,
> Pavel

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: change the base of the Log[] used by LogLogPlot?
  • Next by Date: Re: How to take mean of specific data?
  • Previous by thread: Re: Function argument types
  • Next by thread: change the base of the Log[] used by LogLogPlot?