|
[Date Index]
[Thread Index]
[Author Index]
Re: Argument checking while allowing specific assignments
- To: mathgroup at smc.vnet.net
- Subject: [mg61173] Re: Argument checking while allowing specific assignments
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Tue, 11 Oct 2005 06:29:58 -0400 (EDT)
- Organization: Uni Leipzig
- References: <difudn$h0p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
f[x,8]:=x^2
f[x_Integer,y_Integer] /; x<=12:=MyF[x,y]
f[x_,y_]:=(Message[f::Overflow];$Failed)
Regards
Jens
"Ofek Shilon" <ofek at simbionix.com> schrieb im
Newsbeitrag news:difudn$h0p$1 at smc.vnet.net...
| 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: Sundry Questions
Next by Date:
Re: A few usage based questions
Previous by thread:
Argument checking while allowing specific assignments
Next by thread:
Re: Argument checking while allowing specific assignments
|