Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Load part of a package?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126497] Load part of a package?
  • From: nanobio9 <kuokan.liang at gmail.com>
  • Date: Tue, 15 May 2012 04:52:55 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi, all,

The question is: when one loads a package with quite a lot of
information, for example, PhysicalConstants, often one eventually
finds that only 2 or 3 of them are used, however, a lot of definitions
are loaded in global space. (In this specific example, moreover, Units
package is also loaded, I think.) Similar things happens to my home-
made packages. If I store a lot of pre-calculated results and
definitions and so on in one place (at times I cannot find a
reasonable way to divide them into separate files), I have to load
everything together.

One of the ways to reduce the system load is to write a routine to
load the package, return the item I want, and Clear all other things.
This, however, takes a lot of time of writing stupid programs. For
example, to load a constant value from the PhysicalConstants package,
I have to use a Module in which all of the constants in the package
are declared local explicitly so that they will be "destroyed" after
dismissing the module. Moreover, it will not save the time of loading
the package. I am not good enough to be able to figure out what I
should clean up with the Units package which is invoked by the
PhysicalConstants package. In short, it can be done, but in painful
ways.

So have any of you ever thought of how to handle such situation? More
specifically, is there a "program pattern" with which one only picks
up specific part of a package?

Thank you very much!



  • Prev by Date: Re: unexpected behaviour of Sum
  • Next by Date: Re: unexpected behaviour of Sum
  • Previous by thread: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
  • Next by thread: Partly solved the problem of obtaining part of a package