|
[Date Index]
[Thread Index]
[Author Index]
Re: Problem with MatchQ and SameQ
- To: mathgroup at smc.vnet.net
- Subject: [mg56442] Re: Problem with MatchQ and SameQ
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Tue, 26 Apr 2005 01:32:42 -0400 (EDT)
- References: <d4hvke$1i1$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Miguel wrote:
> Hi,
> Normally I operate with Mathematica 5.0. The functions MatchQ and
> SameQ work well in a notebook but don't it in a programm.
>
> For example,in a notebook
> Clear[f];
> In[1]: f[x_,y_,option_]:=
> If[MatchQ[option,SolutionForm->Explicit],x+y,
> If[MatchQ[option,SolutionForm->Implicit],x*y],Print["Eror"]]
>
> In[2]:
> f[2,3,SolutionForm->Implicit]
> Out[2]:
> 6
> It works well.
>
> In my programm,
>
> <<Calculus`MyProgramm`
> In[3]:
> f[2,3,SolutionForm->Implicit]
> Out[2]:
> Error
>
> Thanks
>
This is not a question of notebook vs program - the problem (I assume)
is that your program is in a package. You must add a usage statement
(before the private section of your package) for both 'SolutionForm' and
'Implicit' - even if the descriptive string is just empty!
I sense you are still fairly new to Mathematica, and it might be better
to avoid creating your own packages for a bit. You can still create .M
files and read them in even if they only contain definitions without a
package structure.
David Bailey
dbaileyconsultancy.co.uk
Prev by Date:
Re: multiple choice IF condition
Next by Date:
Re: multiple choice IF condition
Previous by thread:
Re: Problem with MatchQ and SameQ
Next by thread:
Re: Problem with MatchQ and SameQ
|