Returning rules from functions inside a package context
- To: mathgroup at smc.vnet.net
- Subject: [mg82378] Returning rules from functions inside a package context
- From: Art <grenander at gmail.com>
- Date: Fri, 19 Oct 2007 04:50:56 -0400 (EDT)
The following question has been asked and answered in a variety of
ways in this forum, but I am new to Mathematica and am still not sure what is
best practice after doing Trace of various trivial statements for the
past few hours.
For example, I would like f[] below to return {a->1.}, not
{A`Private`a->1.}.
BeginPackage["A`"]
f::usage = ""
Begin["`Private`"]
f[] := FindFit[{{0, 0}, {1, 1}}, a x, {a}, x]
End[]
EndPackage[]
The use of Rule[] in different scoping constructs is confusing.
Thanks.