This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: X =:= Y (same numbers ?) X =\= Y (different numbers?) X < Y, X > Y, X =< Y, X >= Y (comparisons) is: an infix operator, evaluating the righthand argument, then matching with lefthand argument York University CSE 3401 13 03_Prolog Examples York University CSE 3401 03_Prolog 14 ? 3=:=3. true. ? 3=:=4. false. ? 3=:=2+1. true. ? is(3,2+1). true. ? is(2+1,3). false. ? 2>3. false. ? 2+3. ERROR: toplevel: Undefined procedure: (+)/2 ? is(X,2+3). X = 5. ? is(X,5/2). X = 2.5. ? is(X,5//2). X = 2. ? is(X,5 mod 2). X = 1. ? X is 5//2. X=2. Example York University CSE 3401 15 pop(china, 800). area(china, 4). density(X,Y): pop(X,P), area(X,A), Y is P/A. The population density of a country X is Y, if: The population of X is P, and The area of X is A, and Y is calculated by dividing P by A. : density(china, X). X=200. 03_Prolog...
View
Full
Document
This note was uploaded on 02/14/2012 for the course CSE 3401 taught by Professor Movahedi during the Fall '11 term at York University.
 Fall '11
 Movahedi
 C Programming

Click to edit the document details