From: Jim Morrison
Subject: How to compile lisp
Date: 
Message-ID: <3E7CF71F.1030107@attbi.com>
I am using Common Lisp (17f) on a unix machine.  I'm a student.  I have 
an assignment. So I have my functions all working.  If i run everything 
from the * prompt in lisp i can get all the correct evaluations.  

My question now is how can I compile a file of my functions and a list 
of actions?  If I load my file into lisp (lisp -load myfile.lisp) it 
loads all functions and sets but anything at the end of the file like  

(myfunc mylist)

which would execute my functions with my data to demonstrate the output
does not run?  

I'm assuming I need to do a compile of some sort or is there an easier 
answer?

Jim  

From: Thomas F. Burdick
Subject: Re: How to compile lisp
Date: 
Message-ID: <xcvadfmkbzn.fsf@famine.OCF.Berkeley.EDU>
You've already gotten answers to your questions, but since it sounds
like you're using CMUCL directly from the toplevel, and you haven't
read the documentation, I've got a couple suggestions.  First, you
might try using Hemlock, which is the Emacs-like editor that comes
with CMUCL.  You can start it by typing (require 'hemlock), then (ed)
at the toplevel.  You can find the current Hemlock and CMUCL
documentation here: <http://www.cons.org/cmucl/doc/>.  17f is pretty
old, but the vast majority of the documentation should still be fine.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Jim Morrison
Subject: Re: How to compile lisp
Date: 
Message-ID: <3E7D3A01.5080605@attbi.com>
Thomas F. Burdick wrote:

>You've already gotten answers to your questions, but since it sounds
>like you're using CMUCL directly from the toplevel, and you haven't
>read the documentation, I've got a couple suggestions.  First, you
>might try using Hemlock, which is the Emacs-like editor that comes
>with CMUCL.  You can start it by typing (require 'hemlock), then (ed)
>at the toplevel.  You can find the current Hemlock and CMUCL
>documentation here: <http://www.cons.org/cmucl/doc/>.  17f is pretty
>old, but the vast majority of the documentation should still be fine.
>
>  
>
Thanks Thomas, I'm trying with the documentation but it is difficult 
getting going from scratch.  I appreciate the help.  When I tried 
invoking hemlock I get:

CMU Common Lisp 17f, running on omega.uta.edu
Send bug reports and questions to your local CMU CL maintainer, or to
··········@cs.cmu.edu.
Loaded subsystems:
    Python 1.0, target Alpha
    CLOS based on PCL version:  September 16 92 PCL (f)
* (require 'hemlock)


Error in function COMMON-LISP::INTERNAL-LOAD:  "modules:hemlock" does 
not exist.

Restarts:
  0: [CHECK-AGAIN] See if it exists now.
  1: [USE-VALUE  ] Prompt for a new name.
  2: [CONTINUE   ] Return NIL from load of #p"modules:hemlock".
  3: [ABORT      ] Return to Top-Level.

Debug  (type H for help)

(COMMON-LISP::INTERNAL-LOAD #p"modules:hemlock" NIL :ERROR NIL)
0]

I tried using (ed) just to see if some editor would come up but 
nothing....  Looks like my system here is probably not seriously used, 
just a small amount for student projects the hard way.  Emacs does come 
up but I wasn't able to get a good feel for using it with Lisp.

I do appreciate the help all have given me here, I only need a little to 
get through the not so obvious.  Now I'll probably see all you folks in 
the prolog group in a couple of weeks :-)

Jim
From: Edi Weitz
Subject: Re: How to compile lisp
Date: 
Message-ID: <8765qawjmb.fsf@bird.agharta.de>
Jim Morrison <······@attbi.com> writes:

> I tried using (ed) just to see if some editor would come up but
> nothing....  Looks like my system here is probably not seriously
> used, just a small amount for student projects the hard way.  Emacs
> does come up but I wasn't able to get a good feel for using it with
> Lisp.

Just to make sure there's no misconception here: What other users
suggested was using the ILISP package (see
<http://sourceforge.net/projects/ilisp/>) together with Emacs to
control CMUCL from there, i.e. to use Emacs as an IDE. This was _not_
about using Emacs Lisp. Emacs is also written in a Lisp dialect but
it's very different from Common Lisp and will confuse you.

Just to make sure...

Edi.
From: Henry Lenzi
Subject: Re: How to compile lisp
Date: 
Message-ID: <3e828d7e.233309068@news.cis.dfn.de>
On 23 Mar 2003 09:51:56 +0100, Edi Weitz <···@agharta.de> wrote:

>Jim Morrison <······@attbi.com> writes:
>
>> I tried using (ed) just to see if some editor would come up but
>> nothing....  Looks like my system here is probably not seriously
>> used, just a small amount for student projects the hard way.  Emacs
>> does come up but I wasn't able to get a good feel for using it with
>> Lisp.
>
>Just to make sure there's no misconception here: What other users
>suggested was using the ILISP package (see
><http://sourceforge.net/projects/ilisp/>) together with Emacs to
>control CMUCL from there, i.e. to use Emacs as an IDE. This was _not_
>about using Emacs Lisp. Emacs is also written in a Lisp dialect but
>it's very different from Common Lisp and will confuse you.
>
>Just to make sure...
>
>Edi.
	Yeah, just what I was about to say...If you use Debian,
apt-get install ilisp. Otherwise, I would suggest using XEmacs and
perhaps downloading/installing the ILISP package via their own package
download/install system, which is pretty straightforward.
	Then M-x run-ilisp, and "flavor" cmulisp.

	Regs, good luck.
    	Henry
From: Gabe Garza
Subject: Re: How to compile lisp
Date: 
Message-ID: <874r5vc55o.fsf@ix.netcom.com>
Jim Morrison <······@attbi.com> writes:

> I am using Common Lisp (17f) 

You're confusing the language with one of its implementations--I think
what you're trying to say is "I am using CMUCL 17f".  Saying you're 
using Common Lisp 17f is like saying you drive a Car Corolla. :)

> on a unix machine.  I'm a student.  I have an assignment. So I have
> my functions all working.  If i run everything from the * prompt in
> lisp i can get all the correct evaluations.

If you're not doing so already, look at using emacs with the "ilisp"
package.  I wish I knew of a "Using Emacs to Develop Common Lisp
Applications" tutorial to point you at, but I don't (anyone out there
know of one?).

> My question now is how can I compile a file of my functions and a
> list of actions? 

With the COMPILE-FILE function, e.g.: (compile-file "myfile.lisp")

And then you can load the resulting file of object code with the LOAD
function, e.g.: (load "myfile").

> If I load my file into lisp (lisp -load myfile.lisp) it loads all
> functions and sets but anything at the end of the file like (myfunc
> mylist) which would execute my functions with my data to demonstrate
> the output does not run? 

I'm pretty sure it is running, it's just not producing any output that
you can see.  The "*" prompt is called a "Read, Eval, Print" loop
because it reads a form, evaluates it, and prints the result.  When
you load a file, it reads it (unless it's a compiled file) and
evaluates it--but it doesn't print any of the results.  You can do
that yourself with the PRINT function. (try changing the 
"(myfunc mylist)" calls in your file to "(print (myfunc mylist))".

> I'm assuming I need to do a compile of some sort or is there an
> easier answer?

Actually, I don't think compilation has anything to do with your
problem, but I mentioned COMPILE-FILE anyways because it never hurts
to let someone know that Lisp can be a compiled language. ;)

Gabe Garza
From: Jim Morrison
Subject: Re: How to compile lisp
Date: 
Message-ID: <3E7D0686.5090007@attbi.com>
Gabe Garza wrote:

>Jim Morrison <······@attbi.com> writes:
>
>  
>
>  
>
>>If I load my file into lisp (lisp -load myfile.lisp) it loads all
>>functions and sets but anything at the end of the file like (myfunc
>>mylist) which would execute my functions with my data to demonstrate
>>the output does not run? 
>>    
>>
>
>I'm pretty sure it is running, it's just not producing any output that
>you can see.  The "*" prompt is called a "Read, Eval, Print" loop
>because it reads a form, evaluates it, and prints the result.  When
>you load a file, it reads it (unless it's a compiled file) and
>evaluates it--but it doesn't print any of the results.  You can do
>that yourself with the PRINT function. (try changing the 
>"(myfunc mylist)" calls in your file to "(print (myfunc mylist))".
>
>  
>
>>I'm assuming I need to do a compile of some sort or is there an
>>easier answer?
>>    
>>
>
>Actually, I don't think compilation has anything to do with your
>problem, but I mentioned COMPILE-FILE anyways because it never hurts
>to let someone know that Lisp can be a compiled language. ;)
>
>Gabe Garza
>  
>
Thanks Gabe, you were right.  The Print function is really what I 
needed.  Appreciate the help.

Jim
From: Tibor Simko
Subject: Re: How to compile lisp
Date: 
Message-ID: <87r88wl84g.fsf@pcdh91.cern.ch>
On Sun, 23 Mar 2003, Gabe Garza wrote:
> I wish I knew of a "Using Emacs to Develop Common Lisp Applications"
> tutorial to point you at, but I don't (anyone out there know of
> one?).

E.g. Dan Barlow's oldish CMUCL/Linux HOWTO guide contains some
intro-level ILISP hints <http://ww.telent.net/lisp/howto.html>.
It could be useful to the OP.
From: Nils Goesche
Subject: Re: How to compile lisp
Date: 
Message-ID: <87fzpfc4wg.fsf@darkstar.cartan>
Jim Morrison <······@attbi.com> writes:

> I am using Common Lisp (17f) on a unix machine.

I guess that's an old version of CMUCL, right?

> I'm a student.  I have an assignment. So I have my functions
> all working.  If i run everything from the * prompt in lisp i
> can get all the correct evaluations.  My question now is how
> can I compile a file of my functions and a list of actions?  If
> I load my file into lisp (lisp -load myfile.lisp) it loads all
> functions and sets but anything at the end of the file like
> (myfunc mylist)
> 
> which would execute my functions with my data to demonstrate
> the output does not run?  I'm assuming I need to do a compile
> of some sort or is there an easier answer?

You can compile a file with (compile-file "/foo/bar/baz.lisp").
Then load it with (load "/foo/bar/baz").  Or, if you only want to
execute one program from the Unix command line, try putting

(format t "~&Hello, world!")
(fresh-line)
(finish-output)
(quit)

into a file, then compile it as above and run the program with

cmucl -init baz.x86f

or some such.  If that's not what you wanted to know, please ask
more specifically.

Regards,
-- 
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0
From: Rob Warnock
Subject: Re: How to compile lisp
Date: 
Message-ID: <pKycnSPyC49ZP-CjXTWc-w@speakeasy.net>
Nils Goesche  <···@cartan.de> wrote:
+---------------
| Jim Morrison <······@attbi.com> writes:
| > I load my file into lisp (lisp -load myfile.lisp) ...
| 
| Or, if you only want to execute one program from the Unix
| command line, try putting
|   (format t "~&Hello, world!")
|   (fresh-line)
|   (finish-output)
|   (quit)
| into a file, then compile it as above and run the program with
|   cmucl -init baz.x86f
| or some such.
+---------------

Of course, that will print this:

    % cmucl -init baz.x86f
    ; Loading #p"/home/you/baz.x86f"
    Hello, world!
    % 
 
If you want to get rid of that sometimes-unfortunate message  ;-}  ;-}
(e.g., when you're piping the output somewhere else), try this
instead:

    % cmucl -noinit -eval '(setf *load-verbose* nil)' -load baz.x86f
    Hello, world!
    % 


-Rob

p.s. Or when you get around to reading the documentation about how
to build your own customized CMUCL images (look at "lib/config.lisp"),
you can just build one with *LOAD-VERBOSE* defaulted to NIL (along
with a bunch of other verbosity vars).

-----
Rob Warnock, PP-ASEL-IA		<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Ivan Boldyrev
Subject: Re: How to compile lisp
Date: 
Message-ID: <nqr3lxgbt.ln2@elaleph.borges.cgitftp.uiggm.nsc.ru>
On 8326 day of my life Rob Warnock wrote:
> If you want to get rid of that sometimes-unfortunate message  ;-}  ;-}
> (e.g., when you're piping the output somewhere else), try this
> instead:
> 
>     % cmucl -noinit -eval '(setf *load-verbose* nil)' -load baz.x86f
>     Hello, world!
>     % 

or this:
% cmucl -quiet -load baz.x86f

-quiet seems to be undocumented, but works with CMU CL 18d.


Just my ten copecks :)

-- 
Ivan Boldyrev
PGP fp: 3640 E637 EE3D AA51 A59F 3306 A5BD D198 5609 8673  ID 56098673

                       Perl is a language where 2 x 2 is not equal to 4.
From: Rob Warnock
Subject: Re: How to compile lisp
Date: 
Message-ID: <RuqcnXH6GvJm-R2jXTWc-g@speakeasy.net>
Ivan Boldyrev  <···············@cgitftp.uiggm.nsc.ru> wrote:
+---------------
| Rob Warnock wrote:
| > If you want to get rid of that sometimes-unfortunate message  ;-}  ;-}
| > (e.g., when you're piping the output somewhere else), try this
| > instead:
| > 
| >     % cmucl -noinit -eval '(setf *load-verbose* nil)' -load baz.x86f
| >     Hello, world!
| >     % 
| 
| or this:
| % cmucl -quiet -load baz.x86f
| -quiet seems to be undocumented, but works with CMU CL 18d.
+---------------

I'm running CMUCL 18d, too, yet I get this:

	% cmucl -quiet -load baz.x86f
	; Loading #p"/u/rpw3/.cmucl-init".
	Hello, world!
	% 

I'm guessing that you don't have an accessible init file in your
home directory (e.g., "init.lisp" or ".cmucl-init"), or you'd get
the message, too. I believe the suppression done by "-quiet" occurs
*after* any init file is loaded (though before any "-load" is processed),
which it why this doesn't cut it either:

	% cmucl -quiet -init baz.x86f 
	; Loading #p"/u/rpw3/baz.x86f".
	Hello, world!
	% 

But by combining our suggestions we get the following, which *is*
silent (even if one has an accessible init file):

	% cmucl -noinit -quiet -load baz.x86f
	Hello, world!
	% 


-Rob

-----
Rob Warnock, PP-ASEL-IA		<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Ivan Boldyrev
Subject: Re: How to compile lisp
Date: 
Message-ID: <4md6lx245.ln2@elaleph.borges.cgitftp.uiggm.nsc.ru>
On 8328 day of my life Rob Warnock wrote:
> I'm guessing that you don't have an accessible init file in your
> home directory (e.g., "init.lisp" or ".cmucl-init")

Exactly!  I `touch`ed it, and message appeared.

-- 
Ivan Boldyrev
PGP fp: 3640 E637 EE3D AA51 A59F 3306 A5BD D198 5609 8673  ID 56098673

        Outlook has performed an illegal operation and will be shut down.
        If the problem persists, contact the program vendor.