Skip to content

Instantly share code, notes, and snippets.

@tueda
Last active August 29, 2015 13:56
Show Gist options
  • Save tueda/8934272 to your computer and use it in GitHub Desktop.
Save tueda/8934272 to your computer and use it in GitHub Desktop.
A template for Mathematica packages.
BeginPackage["MyPackage`"];
Unprotect["MyPackage`*"];
ClearAll["MyPackage`*", "MyPackage`Private`*"];
(******************************************************************************)
MyAdd::usage = "MyAdd[a,b] returns a+b.";
Begin["`Private`"];
(******************************************************************************)
MyAdd[a_, b_] := a + b;
(******************************************************************************)
Scan[SetAttributes[#, {Protected, ReadProtected}]&,
Select[Symbol /@ Names["MyPackage`*"], Head[#] === Symbol &]];
End[];
EndPackage[];
@tueda
Copy link
Author

tueda commented May 7, 2015

:%s/MyPackage/NewPackage/g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment