MathGroup Archive 1997

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

Search the Archive

Beware fcn[a_:0, x ___]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9852] Beware fcn[a_:0, x ___]
  • From: bmarks at helix.nih.gov (William B. Marks)
  • Date: Fri, 28 Nov 1997 05:36:07 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

It seems reasonable to want to say
fcn[a_:0, opts___?OptionQ]  := a
for example.

But it doesn't work:
fcn[o->"o"]   gives  o->o  instead of    0.

Instead one can say
fcn[a_:0, opts__?OptionQ] := a

Then
fcn[o->"o"]   gives  0 as it should.

However
fcn[] gives fcn[]
whereas what we wanted originally was for fcn[]  to give  0.

But if you never want to say fcn[],
but only fcn[1], fcn[1, o->"o"] and fcn[o->"o"], for example, the second
form seems to be the best choice.

What do you think?

Bill Marks



  • Prev by Date: New User Question
  • Next by Date: Re: Surface integral
  • Previous by thread: Re: New User Question
  • Next by thread: RE: Interpolating function