Converts Simple List Prolog algorithms to List Prolog algorithms
- Please download and install SWI-Prolog for your machine at
https://www.swi-prolog.org/build/
.
Download this repository.
- Download the LPPM Repository:
mkdir GitHub
cd GitHub/
git clone https://github.com/luciangreen/List-Prolog-Package-Manager.git
cd List-Prolog-Package-Manager
swipl
['lppm'].
lppm_install("luciangreen","Simple-List-Prolog-to-List-Prolog").
halt
-
In Shell:
cd Simple-List-Prolog-to-List-Prolog
swipl
['slp2lp.pl'].
-
Convert Simple List Prolog code to List Prolog code by running:
?- slp2lp([[f1,[a,b,c,d,e],(:-),[[+,[a,b,f]],[+,[c,f,g]],[+,[d,g,h]],[=,[h,e]]]]],Algorithm2),writeln(Algorithm2).
Algorithm2=[[[n,f1],[[v,a],[v,b],[v,c],[v,d],[v,e]],":-",[[[n,+],[[v,a],[v,b],[v,f]]],[[n,+],[[v,c],[v,f],[v,g]]],[[n,+],[[v,d],[v,g],[v,h]]],[[n,=],[[v,h],[v,e]]]]]]