Example #1
0
NAT cont_TermSize(CONTEXT Context, TERM Term)
/*********************************************************
  INPUT:   A context and a term.
  RETURNS: The number of symbols in <Term> with respect to
           the bindings in <Context>
********************************************************/
{
  NAT  result;
  LIST scan;

  Term = cont_Deref(&Context, Term);
  result = 1;
  for (scan = term_ArgumentList(Term); !list_Empty(scan); scan = list_Cdr(scan))
    result += cont_TermSize(Context, list_Car(scan));

  return result;
}
Example #2
0
NAT cont_TermSize(CONTEXT GlobalContext, CONTEXT TermContext, TERM Term)
/*********************************************************
  INPUT:   A global context where index variables are bound
           a context and a term.
  RETURNS: The number of symbols in <Term> with respect to
           the bindings in <Context>
  CAUTION: Variables of <Term1> are bound in 
           <TermContext1>  and
           the index variables are bound in <GlobalContext1>
********************************************************/
{
  NAT  result;
  LIST scan;

  Term = cont_Deref(GlobalContext, &TermContext, Term);
  result = 1;
  for (scan = term_ArgumentList(Term); !list_Empty(scan); scan = list_Cdr(scan))
    result += cont_TermSize(GlobalContext, TermContext, list_Car(scan));

  return result;
}