Programming Language Course Materials This slide is provided by PL TAs: 方士偉,陳奕辰,葉喬之,林冠辰 Department of Computer Science, NCTU for Windows Department of Computer Science, NCTU 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 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 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 Loading Using function memberTest Using function memberTest Department of Computer Science, NCTU for Windows Department of Computer Science, NCTU 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 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 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 Using function factorial Department of Computer Science, NCTU
© Copyright 2024 ExpyDoc