www.delorie.com/gnu/docs/calc/calc_90.html   search  
 
Buy the book!


GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.56 Rewrites Tutorial Exercise 5

If x is the sum a + b, then `nterms(x)' must be `nterms(a)' plus `nterms(b)'. If x is not a sum, then `nterms(x)' = 1.

 
[ nterms(a + b) := nterms(a) + nterms(b),
  nterms(x)     := 1 ]

Here we have taken advantage of the fact that earlier rules always match before later rules; `nterms(x)' will only be tried if we already know that `x' is not a sum.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003