Re: hiding definitions
- To: mathgroup at smc.vnet.net
- Subject: [mg4387] Re: hiding definitions
- From: rubin at msu.edu (Paul A. Rubin)
- Date: Mon, 15 Jul 1996 09:21:37 -0400
- Organization: Michigan State University
- Sender: owner-wri-mathgroup at wolfram.com
In article <4rq82k$k0u at dragonfly.wolfram.com>, alexander.otte at studbox.uni-stuttgart.de (Alexander Otte) wrote: ->Hi! -> ->Is there any way to hide the definition of a function in Mma so that ->it is not visible when using the ?? help command? -> ->Setting the attribute ReadProtected would work, but ->then ?? will not show the options of the function any more. -> ->So is there no way to create your own functions to work like build in ->ones (where ?? gives you the usage and options, but no definition)? -> ->Thanks ! -> -> -> ->****************************************************** -> Alexander Otte -> Department of Physics -> University of Stuttgart, Germany -> E-mail: alexander.otte at studbox.uni-stuttgart.de ->****************************************************** This may not be the most elegant approach, but you can write all your code for function f in a function named ff, say, then ReadProtect ff, and make a new function f (the one you want visible) which simply calls ff, passing all arguments. For instance: In[]:= test2[ x_, opts___ ] := (* I want to hide this function *) x + 1 + Offset /. {opts} /. Options[ test2 ] Options[ test2 ] = {Offset -> 0}; In[]:= test[ x_, opt___ ] := test2[ x, opt ] (* the one I export *) Options[ test ] = { Offset -> 1 }; In[]:= SetAttributes[ test2, ReadProtected ] Paul ************************************************************************** * Paul A. Rubin Phone: (517) 432-3509 * * Department of Management Fax: (517) 432-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE ==== [MESSAGE SEPARATOR] ====