Lisp newbie question 
Author Message
 Lisp newbie question

Hello, I am fairly new to lisp and I am learning to use it more or
less successfully. The question(s) I do have are:

I run clisp from the console (on linux) and there are somethings that
I don't understand using it: When defining functions with defun and
then leaving clisp, they're gone. Is there a way to store these
functions in a file that I load when starting up clisp? I saved a
function in a file called myfun.lsp and tried to start clisp with it
like this: "$>clisp ./myfile.lsp. It wouldn't work. What do I need to
do to access these written-down funtion(s) while running clisp? Is
this common or useful at all? Are there better ways?

Thank you so much in advance for your time and thought.

Alexis



Sat, 30 Apr 2005 23:10:24 GMT  
 Lisp newbie question

Quote:

>Hello, I am fairly new to lisp and I am learning to use it more or
>less successfully. The question(s) I do have are:

>I run clisp from the console (on linux) and there are somethings that
>I don't understand using it: When defining functions with defun and
>then leaving clisp, they're gone. Is there a way to store these
>functions in a file that I load when starting up clisp? I saved a
>function in a file called myfun.lsp and tried to start clisp with it
>like this: "$>clisp ./myfile.lsp. It wouldn't work. What do I need to
>do to access these written-down funtion(s) while running clisp? Is
>this common or useful at all? Are there better ways?

(load "myfile.lsp")

--

Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



Sat, 30 Apr 2005 23:39:53 GMT  
 Lisp newbie question

Quote:

> * On the subject of "Lisp newbie question"
> * Sent on 12 Nov 2002 07:10:24 -0800

> When defining functions with defun and then leaving clisp, they're
> gone.  Is there a way to store these functions in a file that I load
> when starting up clisp? I saved a function in a file called myfun.lsp
> and tried to start clisp with it like this: "$>clisp ./myfile.lsp. It
> wouldn't work. What do I need to do to access these written-down
> funtion(s) while running clisp? Is this common or useful at all?

do
$ clisp -i myfile.lisp
(see <http://clisp.cons.org/clisp.html#opt-init>) or put

(load "myfile")

into you ~/.clisprc and clisp will load it automatically.
(see <http://clisp.cons.org/clisp.html#opt-norc>)

Quote:
> Are there better ways?

Yes, if your files are large and many, you should save the memory image.
(see <http://clisp.cons.org/impnotes/p-indep.html#image>).

It might be a good idea to compile the files, see
<http://www.lisp.org/HyperSpec/Body/fun_compile-file.html>
<http://clisp.cons.org/clisp.html#opt-compile>
<http://clisp.cons.org/impnotes/system.html>

--
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
History doesn't repeat itself, but historians do repeat each other.



Sun, 01 May 2005 02:22:17 GMT  
 Lisp newbie question
Thank very much, I even have received 2 Mails helping me :)

All the best.



Sun, 01 May 2005 03:09:10 GMT  
 Lisp newbie question

Quote:

> Hello, I am fairly new to lisp and I am learning to use it more or
> less successfully. The question(s) I do have are:

> I run clisp from the console (on linux) and there are somethings that
> I don't understand using it: When defining functions with defun and
> then leaving clisp, they're gone. Is there a way to store these
> functions in a file that I load when starting up clisp? I saved a
> function in a file called myfun.lsp and tried to start clisp with it
> like this: "$>clisp ./myfile.lsp. It wouldn't work. What do I need to
> do to access these written-down funtion(s) while running clisp?

(load "./myfile.lsp")

Quote:
> Is this common or useful at all? Are there better ways?

Well, at some point you might want to compile the functions.
Also, most people find it easier to develop lisp code using a suitable
editor, for example Emacs.  I don't know if there is a ilisp package
available for Emacs that will let you execute code directly from
the emacs buffer.  If there is something like that, it will make your
programming life much simpler.

Quote:
> Thank you so much in advance for your time and thought.

> Alexis

--



Tue, 03 May 2005 07:10:52 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Newbie Question (Was: Newbie Question...)

2. Newbie question (DO Loops in Lisp)

3. Newbie Question: LISP seems to be running very slow

4. newbie lisp / gui question

5. lisp newbie's question...

6. Semi-newbie questions: Free LISP for Windows, if LW how to port Allegro

7. lisp ramp-up time (newbie question)

8. newbie Lisp question

9. Newbie question on LISP

10. Newbie question: How to set a default pathname for cmucl as Emacs inferior-lisp

11. a newbie thought about Lisp (Comman Lisp)

12. Not a newbie, but a newbie question...

 

 
Powered by phpBB® Forum Software