Mihaela Malita

Basic Examples in Prolog

Programs run on SWI-Prolog version 7.2.3 by Jan Wielemaker (jan@swi-prolog.org)
First lesson Circle: area & circumference Add two numbers Double a number Arithmetic predicates Bible family Last element of a list Artihmetic mean
Write a list Add prefix and suffix Prefix, suffix, infix Vowels in a word Form a triangle? Even number of elements? Absolute value Maximum
Length of a list Member Increments each element Append (Concatenation) Is a list a set? Remove duplicates Guess the word Select integers from a list
Subset? Cartesian Product of two sets Sets Multiply two vectors Power Greatest Common Divider Graphs Path in a graph
Reverse a list Palindrome Factorial Fibonacci Ackermann's Function MAPCAR Transform a file The nth element of a list
Substitution Ecuation of degree II Deletes an element in a list Anagrams Insert Count occurrences Count letters
First/Last n Circular list Words with given prefix Sort (insertion) Permutation with delete Permutations Combinations