Read Online
Download PDF
Additional resources
Revision history
Known typos/bugs
Report a bug
License terms
About the author

Additional resources

On this page I gather some Mathematica-related materials, both related to the book and not. It is currently under construction, and hopefully will change a lot soon. At the moment it only contains description and links to some packages I wrote. I will add more stuff soon. Enjoy!

Package name Description Dependencies
This package contains various functions to perform certain structural manipulations on one or several lists, such as Union, Intersection and Complement. However, unlike built-ins, the present functions do not sort the resulting list(s) and (in case of Intersection and Complement) do not remove the repeated elements from the lists. The workings of the package are illustrated in a separate notebook.
This package allows one to create a "copy" of a given function of a single argument (Downvalue-based or a pure function), with an internal cache of the fixed size . This cache will automatically store results of the most recent function calls, and use the stored values rather than recompute the r.h.s. in case if the function is called again on the same argument. This may speed-up computations considerably in cases when a function is both computationally intensive and is frequently called on the same values of the argument.
Produces new pure functions at run-time, with the desired sets of attributes but otherwise the same as the original ones. Can also "wrap" the "normal" (DownValue-based) function into a pure function wrapper, with the pure function sharing with the original all Attributes that make sense for pure functions.
For any user-defined (or modified) DownValue-based option-taking function, which uses the ___?OptionQ to declare options, adds new definitions that check options for validity (not just the option name, but also the option's rhs) and can execute arbitrary user- defined code upon receiving inappropriate option(s) (such as returning $Failed, Throw-ing an exception, etc). These new definitions stand higher in DownValues list and execute before the main ones. Unfortunately, the more recent constructs OptionPattern - OptionValue not yet covered. Other limitations also discussed in :Discussion: section of the package documentation. NOTE: the package workings do modify the code of the function to-be-protected by adding new definitions to its DownValues list. There can be situations where this will not be appropriate.
Elevates the functionality of CheckOptions to the level of the package (context), while retains the control on the level of individual functions as well. Adds an easy-to-use interface to "protect" package's functions from inappropriate options. Can work from within the package of interest, or "externally" (in the latter case no code modifications for the package itself are needed). Can be also used for Global` context during interactive development (before putting functions into a package). Essentially, allows to "meta-program" the package by specifying the response actions for each function after (and independently) of the main function's code, and gives the user external control over this responding behavior. Can also be used as a debugging tool. Limitations are discussed in the :Discussion: section of the package documentation.
For a given package/context, answers the following questions: 1. Do there exist symbols in other contexts that depend on symbols in a given one through some global properties (DownValues etc) 2. If so, what they are 3. For a given arbitrary Mathematica expression, what are the symbols used to build it, and their contexts 4. Whether or not a given symbol is shadowed. The package is highly customizable, with its efficiency depending mainly on how much we know about the set of possibly dependent symbols. It can be used to analyze inter-context dependencies in larger projects, and to discover/monitor modifications that a given package induces in other contexts (including overloading system functions). This is also a good practical example of PackageOptionChecks in action, since options here are protected with PackageOptionChecks.
PackageOptionChecks, CheckOptions
Allows to dynamically reload, clear or remove the package's context in a way consistent with general package mechanics in Mathematica. Useful for interactive package development, especially for larger projects with many inter-dependent packages. Dynamic re-loader tracks escaping symbols and (optionally) can automatically resolve possible shadowing problems occuring before or during re-loading.