120 likes | 351 Views
GNU Common Lisp and GNU Prolog for Windows. Programming Language Course Materials. This slide is provided by PL TAs: 方士偉 , 陳奕辰 , 葉喬之 , 林冠辰. GNU Common Lisp. for Windows. GNU Common Lisp for Windows. Download GNU Common Lisp from:
E N D
GNU Common Lisp andGNU Prologfor Windows Programming Language Course Materials This slide is provided by PLTAs: 方士偉,陳奕辰,葉喬之,林冠辰 Department of Computer Science, NCTU
GNU Common Lisp for Windows Department of Computer Science, NCTU
GNU Common Lisp for Windows • Download GNU Common Lisp from: ftp://ftp.gnu.org/pub/gnu/gcl/binaries/stable/gcl_2.6.6.mingw32_cltl1_japi_20050210.exe • Simply just Install and Run it~ • Notice: • The prompt symbol would be ‘>’ or ‘>>’ Department of Computer Science, NCTU
An Example • Let’s say that we have defined a simple function memberTest written in a file, named memberTest.lisp (defun memberTest(e L) (if (null L) nil (if (equal e (first L)) t (memberTest e (rest L)) ) ) ) • Place the file under the this path (for default setting): C:\Program Files\GCL-2.6.6-CLtL1\bin\ Department of Computer Science, NCTU
An Example (Cont’d) • Run GNU Common Lisp • To load your file, type in (load “memberTest.lisp”) • To compile your file, type in (compile-file “memberTest.lisp”) • To load a compiled lisp program, type in (load “memberTest”) Department of Computer Science, NCTU
An Example (Cont’d) Loading Using function memberTest Using function memberTest Department of Computer Science, NCTU
GNU Prolog for Windows Department of Computer Science, NCTU
GNU Prolog for Windows • Download GNU Prolog from: ftp://gprolog.univ-paris1.fr/pub/gprolog/setup-gprolog-1.3.1.exe • Simply just Install and Run it~ Department of Computer Science, NCTU
An Example • Let’s say that we have defined a simple function factorial written in a file, named factorial.pl factorial(0,1). factorial(A,B):- A>0, C is A-1, factorial(C,D), B is A*D. Department of Computer Science, NCTU
An Example (Cont’d) • Run GNU Prolog console • To load your file, click [File] → [Consult…] on the upper side of the console window. Then find out and load your factorial.pl file. • Then, it’s done! Department of Computer Science, NCTU
An Example (Cont’d) Using function factorial Department of Computer Science, NCTU