Mathematica 9 is now available
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: 2nd arg to BeginPackage

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24789] Re: 2nd arg to BeginPackage
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Thu, 10 Aug 2000 00:32:51 -0400 (EDT)
  • References: <8mr1c5$1mj@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Daniel,

Replacing

    BeginPackage["TestPkg`", "Statistics`"];

with

    BeginPackage["TestPkg`"];
    <<Statistics`];

or with

    BeginPackage["TestPkg`"];
    Needs["Statistics`"]

seems to do what you want.


Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Daniel Reeves" <dreeves at eecs.umich.edu> wrote in message
news:8mr1c5$1mj at smc.vnet.net...
> My first question is, there seems to be a discrepancy between the
> documentation for BeginPackage:
>   BeginPackage["Package`", {"Needed1`", "Needed2`", ...}]
> vs how standard packages use it:
>   BeginPackage["Package`", "Needed1`", "Needed2`", ...]
>
> My next question is, why doesn't either form do what I expect here:
>
> BeginPackage["TestPkg`", "Statistics`"];
> ff::usage = "Some function that uses CDF."
> Begin["`Private`"];
> ff[a_] := CDF[NormalDistribution[0,1], a]
> End[];   (* Private context *)
> EndPackage[];
>
> In the definition of ff, it thinks the context for CDF (and
> NormalDistr) is TestPkg`Private` instead of Statistics`...
>
> How can I avoid spelling out the contexts for things like CDF?
>
> Thanks a lot,
> Daniel Reeves
>
> --    --    --    --    --    --    --    --    --    --    --    --
> Daniel Reeves               http://ai.eecs.umich.edu/people/dreeves/
>
> "You think you know when you learn,
>  are more sure when you can write,
>  even more when you can teach,
>  but certain when you can program."  -- Alan Perlis
>
>




  • Prev by Date: Re: extract style sheet from nb w/ private style sheet
  • Next by Date: Re: SetDirectory[ ] for Folders on the Mac Desktop?
  • Previous by thread: Re: 2nd arg to BeginPackage
  • Next by thread: RE: 2nd arg to BeginPackage