|
[Date Index]
[Thread Index]
[Author Index]
Re: The difference between Needs[ ] & Get[ ]
- To: mathgroup at smc.vnet.net
- Subject: [mg40158] Re: [mg40149] The difference between Needs[ ] & Get[ ]
- From: "neuron" <b90401114 at ntu.edu.tw>
- Date: Sun, 23 Mar 2003 04:12:55 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Thanks a lot for detailed answer.
As to this problem,
may I say that Get[ ] can load a file though the context "ComplexMap" in
BeginPackage[ ] and the filename ComplexMap1 are not the same,
but Needs[ ] cannot ?
If so, what are the internal difference which make this result between
Get[ ] & Needs [ ] ?
I apologize in advance for my poor English.
----- Original Message -----
From: "David Park" <djmp at earthlink.net>
To: mathgroup at smc.vnet.net
Subject: [mg40158] RE: [mg40149] The difference between Needs[ ] & Get[ ]
> neuron,
>
> The reason that ComplexMap1 does not load is that Roman has not set it up as
> a package that can load. You can only look at it as a text file to see what
> an early version of the package looked like. That is because he has the
> Begin statement:
>
> BeginPackage["ProgrammingInMathematica`ComplexMap`"]
>
> and it should be
>
> BeginPackage["ProgrammingInMathematica`ComplexMap1`"]
>
> to be correct for loading. "ProgrammingInMathematica" gives the folder name
> and "ComplexMap1" would give the specific file name.
>
> He intends that you actually use the ComplexMap package. (You could also use
> Graphics`ComplexMap`.)
>
> The advantage of the Needs statement over Get is that it can be reevaluated
> and if the package is already loaded it will do nothing. Many packages
> cannot be loaded a second time without generating error messages. It is
> generally more convenient to use Needs. For example, if you open two
> different notebooks that both use the same package and both have
> initialization cells to load the package, the package will only be loaded
> once.
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
> From: neuron [mailto:b90401114 at ntu.edu.tw]
To: mathgroup at smc.vnet.net
>
>
> Hello MathGroup gurus,
> I am new to Mathematica and now reading "Programming In Mathematica."
> I am a little confused with Needs[ ] & Get[ ].
> I kow that Needs[ ] checks $Packages whether the package is present or
> not and I usually use Needs[ ] to load a package.
> On the xiv page of "ProgrammingInMathematica" it says "Even better is
> Needs["ProgrammingInmathematica`Package`"]........"
> but on page 13,
> when I input
> Needs["ProgrammingInMathematica`ComplexMap1`"]
> instead of
> <<ProgrammingInMathematica`ComplexMap1`
> an error occurs:
> Needs::nocont: Context ProgrammingInMathematica`ComplexMap1` was not
> created when Needs was evaluated.
>
> I don't know why, for the Help says "Needs["context`"] calls
> Get["context`"]. By convention, the file loaded in this way is the one
> which contains a package that defines context`. "
>
> I execute Mathematica 4.1 on Windows98
>
> Thanks for any advice.
>
>
Prev by Date:
RE: The difference between Needs[ ] & Get[ ]
Next by Date:
A numerical problem with ConstrainedMin
Previous by thread:
RE: The difference between Needs[ ] & Get[ ]
Next by thread:
Re: The difference between Needs[ ] & Get[ ]
|