Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

RE: functions, packages, and contexts

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25024] RE: [mg24991] functions, packages, and contexts
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 1 Sep 2000 21:57:31 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Matt,

Do you construct and deconstruct the symbol that gives the formula? There
might be a problem according to how you do it.

If you passed the symbol from your main notebook, there wouldn't be a
problem. But if you construct the symbol within the the package, then you
can make it a global symbol by writing it as Global`C1O2. I have even used a
construction like this within a package:

With[{C1O2=Global`C1O2, H2O1=Global`H2O1},
...
w = MW[C1O2];
...
]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

> -----Original Message-----
> From: Matt.Johnson at autolivasp.com [mailto:Matt.Johnson at autolivasp.com]
To: mathgroup at smc.vnet.net
>
> Dear All -
>
> I am new to the package-writing frontier and am running into a problem I
> can't seem to overcome.  The first package I have defines a molecular
> weight (MW) function, which takes a molecule as an argument and
> returns the
> molecular weght.  The molecule must be of the form C1O2, for carbon
> dioxide, for example (each element is followed by the number of atoms of
> that element). The problem I have is that now I am using that package
> within another package.  Because the context has been changed, the
> molecules are sent to the MW function as
> Global`MyPackages`React`C1O2 where
> React is the package I am working in.  The MW function has been written to
> pick out elements and numbers, but cannot handle the additional input of
> the context path.   Is there an easy fix for this, i.e. is there a way to
> send the MW function just the molecular notation within the
> package without
> including the context?  Or do I have to define the MW function to pick off
> the C1O2 from the variable for it to work?
>
> Thanks-
>
> matt
>
>
>



  • Prev by Date: Re: HTML Import?
  • Next by Date: Re: Printing postscript files
  • Previous by thread: Re: functions, packages, and contexts
  • Next by thread: Re: functions, packages, and contexts