Download presentation
Presentation is loading. Please wait.
Published byGiles Walsh Modified over 9 years ago
1
Using Harlequin LispWorks
2
Using LispWorks On BURKS 5, the file is lwper410.exe Start up LispWorks; you get two windows –Listener 1 –LispWorks Personal Edition In the LispWorks Personal Edition window, use Tools -> Editor to open a third window ( Editor 1 )
3
The Windows Use the Listener 1 window to evaluate Lisp expressions directly –CL-USER 1 > (car '(a b c)) A Case doesn't matter in LispWorks In the Editor 1 window, use the Text tab, and use this window to define functions
4
Editing Edit as usual in the Editor window If you know emacs, you can use emacs commands in this window If you don’t know emacs, you are not missing anything essential Save and Save As… work as usual
5
Compiling Use Buffers -> Compile to compile your functions into the Listener window Sometimes the Buffers -> Compile command is on a menu in the LispWorks Personal Edition window –If so, go to Listener -> View -> Options and check Each tool has its own menu bar Test functions in the Listener window
6
Loading Previously Saved Files Use File -> Compile and Load… or use the Lisp LOAD function: (load "C:\\Lisp\\myprog.lsp")
7
Saving a Transcript You need to save and print a transcript of the tests of your function The Listener window doesn’t have any Save commands Keyboard editing shortcuts don’t work But Select All and Copy are on the Edit menu.
8
Example: Searching an AV List (defun lookup (a pairs) (cond ((null pairs) nil) ((eq a (car (car pairs))) (cdr (car pairs))) (t (lookup a (cdr pairs))) ) ) In the Editor window, enter:
9
Compiling In the Editor window, click Buffers -> Compile It says "Press Space to continue", so do so Try the function in the Listener window: CL-USER 20 : 2 > (lookup 'b '((a x)(b y)(c z))) (Y) That’s wrong-- we should get Y, not (Y); go back to the Editor window to fix it
10
Repairing a Function Change the function in the Editor window: (defun lookup (a pairs) (cond ((null pairs) nil) ((eq a (car (car pairs))) (car (cdr (car pairs)))) (t (lookup a (cdr pairs))) ) ) Then compile it and try it again
11
More Built-In Functions (CAR (CAR X)) --> (CAAR X) (CAR (CDR X)) --> (CADR X) (defun lookup (a pairs) (cond ((null pairs) nil) ((eq a (caar pairs)) (cadar pairs)) (t (lookup a (cdr pairs))) ) )
12
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.