Created tests some meta programming internal actions and created a new internal action called .type/2. I t checks whether a term is of a given type or retrieves all the types of the types of term by backtracking them.
E.g.: .type("home page",string) returns true, .type(b,T) unifies T with the term 'atom' and backtracks unifying T with 'literal' and 'ground'.
The approach backtrack was preferred instead of always return the list of types because it seems to be better at least for producing error messages when types do not match. For instance, let us say the programmer was struggling expecting X == Y, but X == "string" and Y == string. In this case, notice that X is a string but Y is an atom. In this case, .type(X,TX) unifies TX with string which is the most "primitive" type of X. But also backtracks ground. .type(Y,TY) unifies TY with atom which is the most "primitive" type of Y, also backtracks ground. So, it is easier to give to the programmer the most primitive type instead of a list. In case of a list is preferred, a .findall can be used, e.g. .findall(T, .type(X,TX) ,TypesOfX).
Created tests some meta programming internal actions and created a new internal action called .type/2. I t checks whether a term is of a given type or retrieves all the types of the types of term by backtracking them. E.g.: .type("home page",string) returns true, .type(b,T) unifies T with the term 'atom' and backtracks unifying T with 'literal' and 'ground'.
The approach backtrack was preferred instead of always return the list of types because it seems to be better at least for producing error messages when types do not match. For instance, let us say the programmer was struggling expecting X == Y, but X == "string" and Y == string. In this case, notice that X is a string but Y is an atom. In this case, .type(X,TX) unifies TX with string which is the most "primitive" type of X. But also backtracks ground. .type(Y,TY) unifies TY with atom which is the most "primitive" type of Y, also backtracks ground. So, it is easier to give to the programmer the most primitive type instead of a list. In case of a list is preferred, a .findall can be used, e.g. .findall(T, .type(X,TX) ,TypesOfX).