RE: lisp basic question
"Denis Howlett" <[email protected]> Wed, 21 Apr 2004 18:11:38 +0100
| Newsgroups | gmane.lisp.allegro |
|---|---|
| Message-ID | <[email protected]> |
Paolo, I think that your best bet is to define your functions in a text file which you can load up later. The advantage of this rather than typing function definitions directly into the interpreter prompt is that you can edit them, add comments etc. You can then define variables using defvar rather than just setq and do everything properly. All the different versions of Allegro have either a built in editor or access to emacs. You can then load the file into your environment using :ld <filename> Finally to change directory, there's a lisp function (chdir &optional directory) (if you grep through the html documentation you should find everything you need). I your text file, you can not only define variables and functions but call lisp, so there'd be no problem in having something like: ---------------------------------------- ;; My first lisp file ;; (defvar my-var 6 "This is my first variable") (defun my-times (x y) "Multiples the two parameters together" (* x y)) (chdir "/usr/home/paolo/tmp") ;; etc... Denis > -----Original Message----- > From: paolo viappiani [mailto:[email protected]] > Sent: 21 April 2004 15:34 > To: [email protected] > Subject: lisp basic question > > > I post this though it might be very basic. But I'm using lisp for a > little while (small didactical project) amd I still did not figure it out. > > as everybody know when I type in the interpreter a symbol or a varable > name, the interpreter answer telling me his value. > > example: > >(setq a 3) > 3 > > >a > 3 > > but how is it possible to recall the body of a function already defined?? > > > (defun p (x) x) > >(p 3) > 3 > >p > error: attempt to take the value of the unbound variable p > > It would nice instead that if I type in the name of the function the > system replies telling me the body of the function!! > > second question: how can I save the current environment (binding > symbols/values, function definition and so on..) of the interpreter (in > ACL 6.2, of a listener) for load it afterward? > > third question: how can I make a script file with command likes change > directory, load these files and so on? > > thank you a lot > paolo* > ---- > > >