Tag Info

New answers tagged

0

Your memoized values are not lost when the package is reloaded, so long as you do not quit the kernel. I did a couple of tests as follows. First without packages, just in the notebook: In[125]:= f[x_] := f[x] = x^2 In[126]:= Table[f[i], {i, 10}] Out[126]= {1, 4, 9, 16, 25, 36, 49, 64, 81, 100} In[127]:= f[x_] := f[x] = x^3 In[128]:= Table[f[i], {i, ...


0

If you merely wanted to reload the package without restarting the Kernel you could use Get; see: When to use Get vs Needs. Since you want a partial reload I suggest writing the Package in parts; you could use e.g. Foo1.m, Foo2.m, Foo3.m etc. (or more descriptive names realistically). Then use Foo.m simply to load these other Package files. This way you ...


8

I am not willing to make MaTeX compatible with Mathematica 9 for the simple reason that it would create too much of a maintenance burden, and I already don't have time to properly respond to all support requests. If anyone is willing to hack MaTeX to work with Mathematica 9, here's what needs to be done. The primary reason why Mathematica 10 is required ...


1

I'm still not sure whether I understand your problem and what you are trying to achieve but I now found something which is not entirely obvious. I think you try to load a sub-package file which was encoded with a key and put its context on $ContextPath. Here is what I think will do what you want: First you need a directory TestApplication in one of the ...


10

FindFile will tell you which file will be loaded when you ask for a particular package with the backtick syntax. DirectoryName will return the directory that contains a file. Example: In[1]:= FindFile["Combinatorica`"] Out[1]= "/Applications/Mathematica 10.1.app/Contents/AddOns/Packages/Combinatorica/Kernel/init.m" Update: This solution is probably ...


1

I think you're confused about context paths, partly because your application only has one package. I assume you have a package called TestPackage.m located in a folder called TestApplication located within FileNameJoin[{$UserBaseDirectory, "Applications"}]? On my machine this folder would be ...


0

I'm a bit embarassed that the answer was so simple. I mentioned that I had the commands in the preamble of the package, i.e. between the BeginPackage statement and Begin["Private"]. What I needed to do was put it in the init.m file instead. Now it works.


2

(this is wiki answer, as just noticed it is duplicate, but will keep it here for easy reference) The result is different from Version 2.2 and version 10.1, this is just to show the difference. Something changed between 1993 and today:


6

It seems that when the book appeared, the behaviour of how a symbol is resolved was different. We have two important things: the current $Context which is usually Global` unless you change it with e.g. Begin as you did the $ContextPath which is a list of contexts that are searched when you type in a symbol like x without explicit context Now there seems ...


1

Would be helpful for you to use the following? By setting On[AbortMessages[test::"notpassed"]] the system will stop loading the package when the message test::"notpassed" is generated. E.g. with: On[AbortMessages[test::"nopass"]]; Do[Print[x]; Message[test::"nopass"], {100}]; only one x will be printed. ClearAll[AbortMessages]; AbortMessages::"usage" = ...


1

This is undocumented so I don't know how stable it is. But worth to point this out. SetAttributes can work on strings if those strings are representing symbols that were already created. Which is usually the case after running a package. moreover, those symbols don't have to have any type of value, just need to be created when read. The point is, you ...


1

I think that you can just do a Get[] or Needs[] to load the package...BTW test this without .NetLink first to make sure you have the directory issues figured out After your package is loaded, you should be able to evaluate SecondDegre[] just like accessing functions inside packages from inside Mma. Ref: ...



Top 50 recent answers are included