Running on tazUse this document, provided by Dr. Wyatt, as a guide:
Fixing TRACE for recursion in CMUCLThis section was also provided by Dr. Wyatt. If you have any questions, please ask him.
By default TRACE does not work in CMUCL as you might expect. Consider, for example:
(defun lenn (l) (if (endp l) 0 (1+ (lenn (rest l))))) CL-USER> (trace lenn) ;; trace lenn (LENN) CL-USER> (lenn '(q w e r)) 0: (LENN (Q W E R)) 0: LENN returned 4 4 CL-USER>We might have wanted to see all of the tracing, including all the recursive calls. In CMUCL, local call is used when a function defined by defun calls itself. This use of local call speeds recursion, but can also complicate debugging, since trace will only show the first call to lenn, and not the recursive calls. This is because the recursive calls directly jump to the start of the function, and don't indirect through the symbol-function. Self-recursive local call is inhibited when the :block-compile argument to compile-file is nil. So to see all the recusive calls, try this -- where the code is in, say, hwk1.lisp:
CL-USER> (compile-file "hwk1" :block-compile nil) ;; compile file ..... CL-USER> (load *) ;; load the compiled file ....... CL-USER> (trace lenn) ;; trace LENN (LENN) CL-USER> (lenn '(q w e r)) ;; trace a call 0: (LENN (Q W E R)) 1: (LENN (W E R)) 2: (LENN (E R)) 3: (LENN (R)) 4: (LENN NIL) 4: LENN returned 0 3: LENN returned 1 2: LENN returned 2 1: LENN returned 3 0: LENN returned 4 4 CL-USER>
Running CMUCL on your own Ubuntu InstallationThis portions describes how to the install (Gnu) Emacs with the Lisp CMUCL software suitable to use in Dr. Wyatt's classes. The target OS for the installation is:
64-bit Ubuntu 16.04 LTS DesktopThis document was last updated February 16, 2017. Virtually all aspects of the installation should go through for recent Ubuntu versions as well.
CMUCLDr. Wyatt's preferred pedagogical choice of LISP is CMUCL, which, as of the date above, provides only 32-bit version, so you'll need to install the 32-bit runtime library packages:
$ sudo apt-get install libc6-i386Find the CMUCL tar balls you need on the release download page:
Look for and download these two version-based files:
cmucl-21b-x86-linux.tar.bz2 cmucl-21b-x86-linux.extra.tar.bz2From the shell, navigate to the downloads and install them in on your system within the "/usr/local" directory:
$ sudo tar xjf cmucl-21b-x86-linux.tar.bz2 -C /usr/local/ $ sudo tar xjf cmucl-21b-x86-linux.extra.tar.bz2 -C /usr/local/This will create the following:
/usr/local/lib/cmucl/ the library files directory /usr/local/bin/lisp the executable fileIn order to match what is expected for the EMACS installation, rename the executable:
$ cd /usr/local/bin/ $ sudo mv lisp cmuclConfirm that cmucl is working by executing it from the shell:
Emacs/SlimeAs of the date of this document Ubuntu uses Emacs version 24. Install it plus slime:
$ sudo apt-get install emacs slimeEmacs uses the hidden init file, ~/.emacs for personal settings. To match the taz installation, install it from here: