functions, packages, and contexts
- To: mathgroup at smc.vnet.net
- Subject: [mg24991] functions, packages, and contexts
- From: Matt.Johnson at autolivasp.com
- Date: Fri, 1 Sep 2000 01:09:26 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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