| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 4)

Creating Generic Formulas

A generic formula applies to an entire class of variables. You can specify that an attribute of any class evaluates to a certain expression.

To create a generic formula:

G2 invokes the Text Editor so that you can enter a formula beginning with the word let, as follows:


When you complete the edit, the new formula appears in a statement box connected to your cursor. Press to place it on a workspace. G2 uses this generic formula to calculate the volume of any gas-meter, if no specific formula exists for the variable.

When writing formulas, a general rule of thumb is to use generic rather than specific formulas whenever possible. This lets you write one formula for an entire class of variables rather than a formula for each variable in the class. A generic formula for a class of variables applies to all classes of variables below it in the class hierarchy; thus, you should try to write generic formulas for classes as far up in the item hierarchy as possible.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 4)

Copyright © 1997 Gensym Corporation, Inc.