|
[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: Sat, 8 Sep 2007 04:04:27 -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: Saving Interpolated Function
Next by Date:
Re: private routines in mathematica 6 packages?
Previous by thread:
Re: private routines in mathematica 6 packages?
Next by thread:
Re: private routines in mathematica 6 packages?
|