Prolog defines a group of built-in predicates for type testing purposes: var/1
, atom/1
, integer/1
, float/1
, atomic/1
, compound/1
, nonvar/1
, number/1
, all of them with quite a self-explanatory meaning if you know the data types of the language. For specific characters, you may exploit unification with that character, after checking that the element is not a free variable (otherwise unification is always successful).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…