GNU Common Lisp and GNU Prolog for Windows
- Slides: 11
GNU Common Lisp and GNU Prolog for Windows Programming Language Course Materials This slide is provided by PL TAs: 方士偉, 陳奕辰, 葉喬之, 林冠辰 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. mingw 32_cltl 1_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 member. Test written in a file, named member. Test. lisp (defun member. Test(e L) (if (null L) nil (if (equal e (first L)) t (member. Test e (rest L)) ) Place the file under the this path (for default setting): C: Program FilesGCL-2. 6. 6 -CLt. L 1bin Department of Computer Science, NCTU
An Example (Cont’d) Run GNU Common Lisp To load your file, type in (load “member. Test. lisp”) To compile your file, type in (compile-file “member. Test. lisp”) To load a compiled lisp program, type in (load “member. Test”) Department of Computer Science, NCTU
An Example (Cont’d) Loading Using function member. Test 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-paris 1. 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