Skip to content

Using online resources to learn basics in Prolog and applying them

Notifications You must be signed in to change notification settings

ABaronCode/Learning_Prolog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Overview: Goldbach theorum of two numbers and shows that every even and positive number is the sum of two prime numbers.
          Length-Compare: Takes lists and checks to see if the first is larger than the second.
          
Website: (Editor and Compiler) https://swish.swi-prolog.org/

Quick Rundown of what the programs do and some examples and their results:
Test Queries for Prolog files
%Tests cases which have to be put into console separately per program

Length-Compare:

%Since ListA>ListB is true the program will return lengths of ListA and ListB to the user.

check_length([a,b,c,d], ListA),
check_length([a,b,c], ListB),
compare_length(ListA, ListB).

%Below the test case will be false and will return false to the console

check_length([a,b], ListC),
check_length([a,b,c], ListD),
compare_length(ListC, ListD).

-------------------------------------------------------------------------------------------------------

Goldbach:
%Will return L = [3,97] to user since 100 is a positive even interger
%Goldbach Conjecture: That every Positive Even number greater than 2 is the sum of two prime numbers.

gb(100, L).

About

Using online resources to learn basics in Prolog and applying them

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages