- Added tuple_to_termlist function.

This commit is contained in:
ccremers 2005-10-07 14:02:46 +00:00
parent 1c075db161
commit 83bf0ec704
2 changed files with 24 additions and 0 deletions

View File

@ -858,3 +858,26 @@ termlist_to_tuple (Termlist tl)
}
}
}
//! Split a tuple term into termlist components.
Termlist
tuple_to_termlist (Term t)
{
t = deVar (t);
if (t == NULL)
{
return NULL;
}
else
{
if (realTermTuple (t))
{
return termlistConcat (tuple_to_termlist (TermOp1 (t)),
tuple_to_termlist (TermOp2 (t)));
}
else
{
return termlistAdd (NULL, t);
}
}
}

View File

@ -56,5 +56,6 @@ Termlist termlistForward (Termlist tl);
int termlistOrder (Termlist tl1, Termlist tl2);
int termlist_iterate (Termlist tl, int (*func) ());
Term termlist_to_tuple (Termlist tl);
Termlist tuple_to_termlist (Term t);
#endif