Content deleted Content added
m Dating maintenance tags: {{Close paraphrasing}} |
m →Types |
||
Line 55:
The main reason for introducing types in logic programming languages is for knowledge representation. Intended interpretations in most logic programming applications are typed and hence using a typed language is the most direct way of capturing the relevant knowledge in the application. Also, the information given by the language declarations of a type system can be used by a compiler to produce more efficient code. Type declarations can help to catch programming errors. In a typed program, typographical errors often lead to syntax errors which can be caught by the compiler.
There are two kinds of type
[[Parametric polymorphism]] is the second most important aspect of the type system. It is common for programmer to want to write a definition of a predicate for which the arguments of the predicate vary in used types. For example, the Append predicate is normally written so that it can append lists of any type. A symbol is polymorphic if its declaration contains a parameter; otherwise it is monomorphic. A polymorphic symbol can be understood as representing a collection of (monomorphic) symbols.
|