4.3 Variables

Variables are available in three syntactic forms.

  1. An upper case letter followed by any sequence consisting of "_" and alphanumeric characters.
    For example:
    List_nums  Head
    
  2. "_", followed by an upper case letter, and then any sequence consisting of "_" and alphanumeric characters.
    For example:
    _Dictionary   _X_1
    
  3. "_" alone denotes an anonymous variable. Repeated occurrences of underscore in a query or rule denote different unnamed variables.

Variables beginning with an underscore should be used when there is just a single occurrence of a variable in a rule. It suppresses the "single occurrence of variable" warning which is given otherwise, which is useful for picking up mis-typed variable names.

On This Site