diff --git a/src/termlist.c b/src/termlist.c index 51aed1b..5373259 100644 --- a/src/termlist.c +++ b/src/termlist.c @@ -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); + } + } +} diff --git a/src/termlist.h b/src/termlist.h index 254c809..f7783be 100644 --- a/src/termlist.h +++ b/src/termlist.h @@ -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