next up previous
Next: Dot mode operators Up: Dot Mode Previous: The token list

Calling Macaulay commands

When an oper token representing a Macaulay command is evaluated, the ident and number tokens immediately to its right on the token list are used as arguments to the corresponding command. After execution of this command, the command token and its arguments are removed from the token list.

The save operator ` confers an extra life to the next argument; save operators are ignored during the scan for command arguments, and are removed afterwards instead of the arguments they protect. For example:

.% betti res (dsum r r `_) `_
$ betti res ( dsum r r ` @00@1 ) ` @00@2 $ 
              ^                            
$ betti res ( @00@1 ) ` @00@2 $ 
                    ^           
$ betti res @00@1 ` @00@2 $ 
        ^                   
0.1...
computation complete after degree 1
$ betti @00@2 $ 
  ^             
total:      2     6     6     2 
--------------------------------
    0:      2     6     6     2
Any number of save operators can be applied to a given argument, in which case only one save per argument will be removed at a time. Save operators can outlive their enclosing parentheses.

Most commands have at least the option of returning values via their last argument or arguments. There is now an internal table in Macaulay giving a preferred number of arguments when commands are used this way. In dot mode, if this preferred argument count is greater than the number of arguments actually provided, then at the time of command execution, the token list is automatically padded with the desired number of `_ token pairs. Thus, the above can be more succinctly written as

.% betti res dsum r r
0.1...
computation complete after degree 1
total:      2     6     6     2 
--------------------------------
    0:      2     6     6     2

To allow access to command help, padding does not take place if the command is the leftmost token on the token list. The preferred argument counts can be inspected and modified using the args command described in Section 1. We did not implement a maximum argument count table, in the belief that requiring parentheses in affected cases would improve readability.



Sorin Popescu
Sun Dec 22 18:20:57 EST 1996