|
[Date Index]
[Thread Index]
[Author Index]
Re: private routines in mathematica 6 packages?
- To: mathgroup at smc.vnet.net
- Subject: [mg81048] Re: private routines in mathematica 6 packages?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 9 Sep 2007 06:14:54 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <fbqqme$79m$1@smc.vnet.net>
Tanim Islam wrote:
> How do I make certain functions within a mathematica package private or
> protected? By private or protected, I mean that these functions cannot be
> called directly by the user in a mathematica notebook.
Enclose all your function within a private block (f and g in the example
below). Write a usage message for the functions that must be exported (f
in our case), everything else will be hidden (that is g in the toy example).
-------------------------- beginning of the file -----------------------
BeginPackage["mypackage`"]
f::usage = "f[x] returns the square of the sin of x."
Begin["`Private`"]
g[x_] := Sin[x]
f[x_] := g[x]^2
End[ ]
EndPackage[ ]
----------------------------- end of the file --------------------------
--
Jean-Marc
Prev by Date:
Re: a simple question about contour3D
Next by Date:
Re: Plotting a straight line in a 3D plot
Previous by thread:
Re: private routines in mathematica 6 packages?
Next by thread:
[Mathematica 6.0.1] Confusing documentation on ColorData, where to get list of ColorFunctions ?
|