-
Notifications
You must be signed in to change notification settings - Fork 0
5_things_I_wish_I_knew_WF2012
- listLocalSymbols - display of local symbols and their values is very helpful for debugging
- PackageImports and PackageExports will replace needsPackage in version 1.5
- never type use R inside a package (it will potentially rewrite the user's variables)
- To help with debugging, if you want to print something to the screen
while running, you can do
- << L << endl;
- (The << prints to the screen, and endl is a line break)
- for i from 1 to 5 list ( if i ==1 then continue else i)
- This code is just like apply, although it has the option to use "continue" to not add an element to the list.
- The function drop(L,n) which drops the first (or last) n elements from a list depending on whether n is positive (or negative)
- One may store additional data in a ring. For example, if S=QQ[x,y,z], one may store additional information about this ring as follows: S#info="useful info" and then access it later by S#info.
- Running M2 with option -q may get rid of unexpected warnings.
When creating and subsequently overloading a method, avoiding the use of TypicalValue will prevent provlems in documentation. Instead, note the value of the output of the method(s) as follows:
newMethod = method()
newMethod InputType1 := OutputType1 -> I -> (
--desired commands for this method
)
--overloading newMethod
newMethod InputType2:= OutputType2 -> J -> (
--desired commands for this method
)
Then, documentation is entered as follows:
doc ///
Key
(newMethod, InputType1)
Headline
newMethod taking InputType1 to OutputType1.
Usage
O = newMethod I
Inputs
I: --will automatically add the type InputType1
Outputs
O: --will automatically add the type OuputType1
///
doc ///
Key
(newMethod, InputType2)
Headline
newMethod taking InputType2 to OutputType2.
-- etc.
///
Return to the main WF2012 page
I can use Hom as the name for my functions. I can implement the method _ to my data type. MutableHashTable, and sorts of nice functions like netList, all. I can use svn and keystrokes with emacs.
-
Home
- Introduction
- Macaulay2 Contribution Guides
- Macaulay2 Workshop Guides
-
Macaulay2 Internals
- Building Macaulay2 from source
- Components of Macaulay2
- Case Studies
- Web servers
- Other
- Frequently Asked Questions
- Road map