Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites

Wolfram Library Archive


All Collections Articles Books Conference Proceedings
Courseware Demos MathSource Technical Notes
Title Downloads

Named Patterns in (lhs->rhs), (lhs=rhs), (lhs^=rhs), (f/:lhs=rhs)
Author

Ted Ersek
Organization: Naval Air Warfare Center, Aircraft Division
URL: http://www.verbeia.com/mathematica/
Old MathSource #

0210-609
Revision date

2004-05-14
Description

The functions Rule, Set, UpSet, TagSet each evaluate their right side immediately. If these functions have named patterns on the left side and the symbols used to name the patterns are needed on the right side then the global values of these symbols are used on the right side. To get the intended result you must ensure these symbols have no global values. This is demonstrated in the (LocalPatterns.nb) notebook.

The package (LocalPatterns.m) defines functions that work like Rule, Set, UpSet, TagSet but don't have the problem described above. All functions in the package are demonstrated and explained in the notebook (LocalPatterns.m).

LocalPatterns.m uses four special characters. A modified version of the BasicInput palette is provided to assist with entering the special characters. The modified palette is also explained in the (LocalPatterns.nb) package.
Subject

*Mathematica Technology > Kernel > Pattern Matching
Keywords

Set, Rule, UpSet, TagSet, scope
Downloads Download Mathematica Player

BasicInput2.nb (14.3 KB) - Mathematica palette [for Mathematica 5.0]
LocalPatterns.m (6.1 KB) - Mathematica package [for Mathematica 5.0]
LocalPatterns.nb (30.2 KB) - Mathematica notebook [for Mathematica 5.0]


 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: