Prolog programming

Topics:

First try to play with following examples. Read source code and try to understand it. Then read the materials below.

(These materials is my notes from book "Programming in Prolog")

Examples:

play with simple arithmatic operation in prolog command window: Arithmetic predicates

some arithmatic operation source code(some example takes simple read and write functions): Absolute value Add two numbers Double a number Artihmetic mean Circle: area & circumference(this example contains a minor error, can you find it and fix the problem?)

relation arithmatic operation code: Form a triangle?

arithmatic operation with recursion: Power Factorial(factorial second source code has some problem. modify it and make it works)

first touch with list: print all members in the list(need a minor modification)

more simple list examples: member in the list(actually, member is a default predicate. So, for this example, just read the source code. If you really want to make code working, just modified name "member" to be "mymember") The vowels in a word Length of list(remove member predicate from source code)

1. Syntax

2. Equality and Matching

3. Arithmetic

Assignment1

Assignment2

4. Basic about lists(a simple list tutorial)

Assignment3(bonus one!!)

 

Assignments need to check out by TA