Both sides previous revisionPrevious revisionNext revision | Previous revision |
public:t-622-arti-11-1:lab_1_materials [2011/01/13 12:29] – angelo | public:t-622-arti-11-1:lab_1_materials [2024/04/29 13:33] (current) – external edit 127.0.0.1 |
---|
* A freely available book on Lisp: [[http://gigamonkeys.com/book/|Practical Common Lisp]]. | * A freely available book on Lisp: [[http://gigamonkeys.com/book/|Practical Common Lisp]]. |
* IDE and Lisp Implementations: | * IDE and Lisp Implementations: |
* Lispbox 0.7, an Emacs + SLIME + Common Lisp easy to install package ([[http://www.ru.is/faculty/hannes/share/lispbox07.exe|Win32]]) or ([[http://www.ru.is/faculty/hannes/share/Lispbox-0.7-with-acl81_express.dmg|MAC OS X]]). | * Lispbox 0.7 (Stable Release), an Emacs + SLIME + Common Lisp easy to install package ([[http://www.ru.is/faculty/hannes/share/lispbox07.exe|Win32]]) or ([[http://www.ru.is/faculty/hannes/share/Lispbox-0.7-with-acl81_express.dmg|MAC OS X]]). |
| * [[http://common-lisp.net/project/lispbox/|Lispbox]] (Latest Unstable Beta Version): ([[http://common-lisp.net/project/lispbox/test_builds/lispbox-0.7-sbcl-1.0.38.tar.gz|Linux 32-bit]], [[http://common-lisp.net/project/lispbox/test_builds/lispbox-0.7-x64-sbcl-1.0.38.tar.gz|Linux 64-bit]]), ([[http://common-lisp.net/project/lispbox/test_builds/lispbox-0.7-ccl-1.5-windowsx86.zip|Win32]]) or ([[http://common-lisp.net/project/lispbox/test_builds/Lispbox-0.7-with-ccl-1.5-darwinx86.dmg|MAC OS X]]). |
* Eclipse Lisp Plugin (Win32, MAC OS X and Linux): [[http://sourceforge.net/projects/dandelion-ecl/|Dandelion]]. | * Eclipse Lisp Plugin (Win32, MAC OS X and Linux): [[http://sourceforge.net/projects/dandelion-ecl/|Dandelion]]. |
* Emacs reference card: ([[http://refcards.com/docs/wingb/xemacs/xemacs-refcard-a4.pdf|PDF Format]]). | * Emacs reference card: ([[http://refcards.com/docs/wingb/xemacs/xemacs-refcard-a4.pdf|PDF Format]]). |
To work through these exercises, refer to the above material for more information. | To work through these exercises, refer to the above material for more information. |
| |
- **Emacs and REPL:**\\ Install [[http://common-lisp.net/project/lispbox/|LispBox]] on your computer and start it up. The upper window is the Lisp REPL (read-eval-print loop) where you can enter Lisp expressions and have them evaluated. | - **Emacs and REPL:**\\ Install [[http://common-lisp.net/project/lispbox/|LispBox]] on your computer and start it up. The lower window is the Lisp REPL (read-eval-print loop) where you can enter Lisp expressions and have them evaluated. |
- **Hello World:**\\ Type an expression that prints "Hello World!" on the screen. \\ <code lisp> | - **Hello World:**\\ Type an expression that prints "Hello World!" on the screen. \\ <code lisp> |
;; HINT: A typical print expression | ;; HINT: A typical print expression |
'(:x 0 :y 0 :dirty T) | '(:x 0 :y 0 :dirty T) |
</code> Here, **'':x''** and **'':y''** are the location of the agent and **'':dirty''** tells us if the current square has dirt or not. \\ | </code> Here, **'':x''** and **'':y''** are the location of the agent and **'':dirty''** tells us if the current square has dirt or not. \\ |
- Write a new agent program called **''random-agent-program''**, that has two options: Walk around the environment randomly or remain idle when it finds a clean square; Suck up dirt when it finds it. \\ Your agent program should return one of the symbols **''LEFT''**, **''RIGHT''**, **''UP''**, **''DOWN''**, **''SUCK''** or **''IDLE''**. You can either write your function directly in the REPL or add it to the file. If you add it to the file, you have to save the file (keyboard shortcut is Ctrl+X, Ctrl+S in emacs) and then reload the file in the REPL (recommended option). Instead of typing the load command again, you can reload the file by hitting Ctrl+C, Ctrl+L while the file window is active.\\ <code lisp> | - Write a new agent program called **''random-agent-program''**, that has two options: Walk around the environment randomly or remain idle when it finds a clean square; Suck up dirt when it finds it. \\ Your agent program should return one of the symbols **''LEFT''**, **''RIGHT''**, **''UP''**, **''DOWN''**, **''SUCK''** or **''IDLE''**. You can either write your function directly in the REPL or add it to the file. If you add it to the file, you have to save the file (keyboard shortcut is Ctrl+X, Ctrl+S in emacs) and then reload the file in the REPL (recommended option).\\ <code lisp> |
;; HINT: Getting a random value. | ;; HINT: Getting a random value. |
;; This function returns a random nonnegative number less than number, and of the same type (either integer or floating-point) | ;; This function returns a random nonnegative number less than number, and of the same type (either integer or floating-point) |