Hot answers tagged

8

To not mess with $ContextPath you can Block it just for that evaluation. e.g. Block[{$ContextPath = {}}, ...]. But we don't want to do that for evaluation, input for FullForm should be evaluated freely and only the result should be returned with full symbols' names. Here is what you should know: $ContextPath also affects the typesetting. MakeBoxes will ...


7

If you look at the definition of NotebookEvaluate, by means of Needs["GeneralUtilities`"]; GeneralUtilities`PrintDefinitions[NotebookEvaluate] you see that the design is strange: always $ParentLink is set to First@$FrontEnd, and the designer obviously never thought about your use case. However, it is easy to achieve what you want, just define e.g. ...


5

In addition to Rolf's workaround. This is expected and works the same in V9 and V10. NotebookEvaluate / Details & Options: By default, NotebookEvaluate evaluates the cells of a notebook in the same way that Get evaluates the lines of a package file. Messages, print output, and other side effects will be placed as output to the cell that called ...


2

Based on Kuba's idea, this may also work: RawBoxes@MakeBoxes[FullForm[p + q]] /. x_String :> Context[Evaluate@Symbol@x] <> Last@StringSplit[x, "`"] /; NameQ[x]


1

Looks like this is a problem with the Suggestions Bar http://mathematica.stackexchange.com/a/75284/6804 When I disable it, I get the same context path consistently. This is version 10.2. The problem does not appear in 10.4, suggestions bar on or off...


1

Consider using strings: BeginPackage["foo`"]; Unprotect @@ Names["foo`*"]; ClearAll @@ Names["foo`*"]; f::usage = "sol=f[x,plist]"; Begin["`Private`"]; f[x_, plist_] := With[{y = Lookup[plist, "y"], z = Lookup[plist, "z"]}, x + y + z]; End[]; Protect @@ Names["foo`*"]; EndPackage[]; paramList = {"y" -> 1, "z" -> 2}; sol = foo`f[x, paramList] Or ...



Only top voted, non community-wiki answers of a minimum length are eligible