1 / 12

Using Harlequin LispWorks

Using Harlequin LispWorks. 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 ). The Windows.

kovit
Download Presentation

Using Harlequin LispWorks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 Copyare on the Edit menu.

  8. Example: Searching an AV List • In the Editor window, enter: (defun lookup (a pairs) (cond ((null pairs) nil) ((eq a (car (car pairs))) (cdr (car pairs))) (t (lookup a (cdr pairs))) ) )

  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

More Related