MathGroup Archive 2005

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

Search the Archive

Argument checking while allowing specific assignments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61158] Argument checking while allowing specific assignments
  • From: "Ofek Shilon" <ofek at simbionix.com>
  • Date: Tue, 11 Oct 2005 04:49:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello dear mathgroup.

I'm writing a function that has certain argument checks, e.g. (a
simplified version):

F[x_,y_] := If[x>12 , Message[F::Overflow], MyF[x_,y_]]

that is, the heart of the implementation is in MyF[x_,y_].
Now, further down the session i (or the user) may wish to set specific
values for certain arguments. e.g:

F[x_,8] := x^2

However, if i write it as above, argument checking is bypassed. the
'proper' way of doing this would be to set MyF[x_,8] as desired, but
that holds much confusion potential:  i wish for the user to be
familiar with a single symbol per function.

Anyone knows a mechanism by which i can check the arguments of F, and
still be able to assign special values to F (and not it's internal
representation)?

thanks,

   Ofek


  • Prev by Date: Re: sqrt(x^2) = x
  • Next by Date: Mathematica GuideBooks for Numerics and Symbolics published
  • Previous by thread: Re: A few usage based questions
  • Next by thread: Re: Argument checking while allowing specific assignments