Programming Language Theory: Difference between revisions
| Line 116: | Line 116: | ||
===Logic Programming=== | ===Logic Programming=== | ||
''' | Non-procedural statements of relationships built atop a ''unification'' algorithm and database. | ||
====Prolog==== | |||
Language elements include facts, queries, variables, rules and data structures. Queries are made relative to a base of facts expressed as ''functors'' on ''atoms''. Anonymous variables are supported via '_'. | |||
* All satisfactions of a query are returned, as they're discovered. | |||
* Several queries can be conjoined via ','; unification of such a system might require ''backtracking''. | |||
* Rules are dependencies among facts, expressed as unions of intersections (multiple right-hand-sides, each with arbitrarily many conjunctions). For <tt>a :- b, c</tt>: | |||
** Backward chaining -- seeking truth of <tt>a</tt> via proof of <tt>b, c</tt> | |||
** Forward chaining -- concluding truth of <tt>a</tt> via discovery of <tt>b, c</tt> | |||
* Lists are formed via square brackets, and '|' divides the car and cdr of a list | |||
===Constraint Programming=== | ===Constraint Programming=== | ||