Re: Function argument types
- To: mathgroup at smc.vnet.net
- Subject: [mg112953] Re: Function argument types
- From: Murray Eisenberg <murray at math.umass.edu>
- 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 Head[5] Integer 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 math.umass.edu 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