Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:beginner:cram_prolog [2019/07/10 14:55] gkazhoyatutorials:beginner:cram_prolog [2022/05/26 12:32] (current) – [Using built-in predicates] schimpf
Line 31: Line 31:
 (((?X . 1)) ((?X . 2)) ((?X . 3))) (((?X . 1)) ((?X . 2)) ((?X . 3)))
 </code> </code>
 +
 +=== Using unbound variables ===
  
 Variables in CRAM Prolog are represented by any symbol that starts with ''?'' (question mark). \\ Variables in CRAM Prolog are represented by any symbol that starts with ''?'' (question mark). \\
Line 44: Line 46:
 Then we get one correct possible assignment for all the variables as one entry of the lazy list. Then we get one correct possible assignment for all the variables as one entry of the lazy list.
  
 +It is important to remember that the ` is needed for unbound variables, not the ' or you will get an error.
 +
 +=== No solution ===
 If there are no solutions for the query Prolog returns NIL: If there are no solutions for the query Prolog returns NIL:
 <code lisp> <code lisp>
Line 56: Line 61:
 (NIL) (NIL)
 </code> </code>
 +=== Using lisp with prolog code ===
 The CRAM Prolog interpreter finds solutions by performing a depth first search over the predicate tree, that it, it first searches for possible bindings for the first predicate, then branches into multiple search paths, one per each assignment, and continues with the second predicate, and so on. The mechanism is the same as in any other Prolog implementation. The CRAM Prolog interpreter finds solutions by performing a depth first search over the predicate tree, that it, it first searches for possible bindings for the first predicate, then branches into multiple search paths, one per each assignment, and continues with the second predicate, and so on. The mechanism is the same as in any other Prolog implementation.
  
Line 106: Line 111:
  
  
-Now that we are familiar with the CRAM Prolog syntax, let's dive right into resolving CRAM abstract entity descriptions (called designatorsusing Prolog ...+Now that we are familiar with the CRAM Prolog syntax, let's dive right into resolving CRAM abstract entity descriptionscalled designatorsusing Prolog ...
  
 **Next Tutorial:** [[tutorials:beginner:motion_designators|Creating motion designators for the TurtleSim]] **Next Tutorial:** [[tutorials:beginner:motion_designators|Creating motion designators for the TurtleSim]]