/** to_functor( ?Term, ?Functor ). Mostly convert a Term to a Name/Arity Functor structure. Term can also be Name/Arity in which Functor is identical to Term. For atoms, Functor is Name/0. Finally for +Functor -Term is generated. @tbd need to mondernise with regard to Name/0 terms. */ to_functor( In, Out ) :- \+ var(In), !, ( In = Name/Arity -> true ; ( compound(In) -> functor( In, Name, Arity ) ; Name = In, Arity = 0 ) ), Out = Name/Arity. to_functor( In, Out ) :- \+ var( Out ), Out = Name/Arity, functor( In, Name, Arity ).