From: Andy Reiter
Subject: A ton of CLISP questions.
Date: 
Message-ID: <d4b78695.0203241224.90fc1aa@posting.google.com>
Hi,

My first post in here. I am learning Lisp on my own (but I am an
experienced
programmer otherwise) I am running Windows 98, and Clisp 2.27,
installed from
the binary.
I have "Winston & Worn", CLtL2, and -thanks Paul- "On Lisp". I also
read every
other online publication I could lay my hands on.

I tried both LW and AL, but they are too big for my machine, so Clisp
is the
last choice (and believe it, the best one :-)

Here are my questions:

1) How do I get network/regex/database access from within my code? In
Perl, and
most other languages, I import a package, and use all the function,
and data-structures defined in the namespace.
I have seen the chapter on packages in CLtL2, but I really don't grok
it. The
Package->symbol naming convention doesn't seem standarized. Please
tell me
where are the packages, within the installation directory, and how can
I call
them?
Am I wrong in looking for "physical" packages? C/C++ has #include REAL
files,
which I can read modify and learn from. Also Java/Perl/Python
import/use REAL files.
CLISP doesn't seem to have a "lib" or "include" directory, where I can
go to,
and see what is there.

2) What is the CLISPly correct way to organize your code? I see there
isn't any
seperation of defenition and declaration -Lisp has a badass way of
solving forward references- but how do I split my code into
functions/variables/structs/classes/macros?
Does each belong to its own file? what do I name those file?

I saw the CLISP sources, and there are *.d files. They look like
generated/pre-processed code. What are they?

3) I am well versed in OOP, but also, I am well versed in C/procedural
coding.
 Were does Lisp stand, inbetween the two?
I was told that global variables were bad, but I have seen
Winston&Horn define
a global variable and write functions that manipulate it. Is that the
big'' picture of Lisp coding, or is it just a vehicle for teaching.

In C, I make sure to put any necessary global variables in a
structure, and
pad an special prefix to it, to make it stand out.
Are Lisp's global variables, OK in the sense that they are only used
for BIG
data structures, or is it customary to have tiny little flags/integers
float around, in the code.

4) Ctags, Ctags, Ctags. I am starting to learn Emacs just for Lisp
coding. I
saw "etags" in the emacs directory, and have seen some tutorials on
how to use
it with C code. Can some good soul show me the keys I need to press,
to have
emacs show me the defenition of a variable, wethere some car is a
function or
macro, the expanssion of a macro, etc.

5) I use CLISP directly from within emacs -I know neither well- is
there some
way I can rename "DESCRIBE" and "APROPOS" to something shorter? those
are my
most used functions :-D

6) Is there some document on how to use the chunk of CMUCL libraries
with CLISP?
I know what to change, in order to make a Borland C code compile on
DJGPP. This
varies from rewriting the makefile, (re|un)defining some macros, to
recompiling
an entire libarary, and even changing the calling convention of some
functions.
Is there are compatibility layers between CLISP and CMUCL? something
like "oh, just use the Makefile.clisp" to "don't touch that, it knows
about the CMUCL FFI
and expects the function __rekhavok.

7) Lisp rules :-)
I see between the ()s, and I think in prefix. Besides, it gave a
myriad of
short and interesting function/macro names, that I can use in my C
code. A very
compact, but complete naming convention :-)

From: Matt Curtin
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <86sn6pa9z0.fsf@rowlf.interhack.net>
·······@flop.co.uk (Andy Reiter) writes:

> 1) How do I get network/regex/database access from within my code? 
> In Perl, and most other languages, I import a package, and use all
> the function, and data-structures defined in the namespace.

Network access is present in CLISP, but rather than using CLISP's
native socket interfaces, you're probably better off using PORT, a
portability library that will make your code that uses its interfaces
work under various Lisp implementations.

PORT is available from the CLOCC site, http://clocc.sourceforge.net/.

Also, be sure to look at CLLIB, which will provide you interfaces to a
few other goodies, including HTML generation, HTTP utilities, XML
parsing, and much, much more!  Ahem, sorry, got carried away.

CLOCC has a nice INSTALL and Makefile that should help you get CLOCC
installed and will help you figure out how the packages in Lisp work.
(Perl's packaging system is quite similar.)

I don't know how to add regex functionality to CLISP under Windows.
It's a straightforward process under Unix, though.

There are a few database access libraries floating around.
UncommonSQL is one, and another thread on the newsgroup right now
mentions a new one, CLSQL.  I haven't personally done a lot of
Lisp-talking-to-SQL, so I'll leave that to folks who have more than a
strictly theoretical understanding. ;-)

> 2) What is the CLISPly correct way to organize your code? I see
> there isn't any seperation of defenition and declaration -Lisp has a
> badass way of solving forward references- but how do I split my code
> into functions/variables/structs/classes/macros?  Does each belong
> to its own file? what do I name those file?

In Lisp, you'll likely find yourself writing a lot of "library" code
to build the language up to your problem.  When you're writing that
kind of library code, it's best to put that in separate files from
your main application.  It's also best to separate things by purpose,
e.g., library code to talk to printers would go in a different file
from library code to talk to databases, unless you've figured out some
super high-level way to talk to "places to write stuff".

> 3) I am well versed in OOP, but also, I am well versed in
> C/procedural coding.  Were does Lisp stand, inbetween the two?

Common Lisp is properly classed as a multiparadigm language.  Just as
one can use an OO or procedural paradigm with C++ or Perl, one can use
OO, procedural, or functional paradigms with Lisp.  Idiomatically,
Lisp is often written functionally.

Also, note that Common Lisp's notion of OO is a generalized and much
more flexible than many other languages' notion of OO.  Paul Graham's
/ANSI Common Lisp/ has a good introduction to the Common Lisp Object
System (CLOS, usually pronounced "see-loss").

> I was told that global variables were bad,

Sound advice.  If the answer is "global variable", the question is
probably the wrong one.

> Are Lisp's global variables, OK in the sense that they are only used
> for BIG data structures, or is it customary to have tiny little
> flags/integers float around, in the code.

There are standards that have emerged.  For example, in Lisp, there
are "special" variables, which are much like "globals" in other
languages.  The most common way to identify these is by putting *
characters on either side of the symbol name, e.g., *FOO*.

> 4) Ctags, Ctags, Ctags. I am starting to learn Emacs just for Lisp
> coding.

See the manual (man) and info pages for etags.  etags can be used on
Lisp code in addition to source for C, LaTeX, and other goodies.

> 5) I use CLISP directly from within emacs -I know neither well- is
> there some way I can rename "DESCRIBE" and "APROPOS" to something
> shorter? those are my most used functions :-D

I assume that you're using the ILISP ("Inferior Lisp") package to do
so?  If you're not, you should.  Links to the code are available from
the CLISP site.  If you're using XEmacs and the SUMO package tarball,
you'll have ILISP already installed.  I have a few variables set that
makes ILISP work better for me; perhaps you'll find some of these
useful.  The following s-expression is in my XEmacs startup.

(setq clisp-hs-program "clisp -I -q"
      ilisp-*use-frame-for-arglist-output-p* t
      ilisp-*use-frame-for-output t
      ilisp-bindings-*bind-space-p* nil)

There are several things you could do to ease your interfaces to
DESCRIBE and APROPOS.  (While on that topic, do you know about the
CLHS interface that is provided in ILISP?  Stick your cursor over a
DEFUN or something and hit `C-z H'.  How cool is that!)

One obvious and straightforward way would be to have small functions
in Emacs Lisp that would write "(describe )" and "(apropos )" and put
the cursor in the right place.  You could easily bind that to a
function key or whatever is convenient for you.

> 6) Is there some document on how to use the chunk of CMUCL libraries
> with CLISP?

I believe this question tends to portability between the two Lisps.
See my earlier note on PORT.

> 7) Lisp rules :-) I see between the ()s, and I think in
> prefix. Besides, it gave a myriad of short and interesting
> function/macro names, that I can use in my C code. A very compact,
> but complete naming convention :-)

You might well find that with some more practice, you'll not only see
between the parens but become annoyed by less-enlightened languages
that require their users to memorize inconsistent syntax.

Welcome to Lisp programming.  I'm sure that you'll find the experience
rewarding, as I have.

-- 
Matt Curtin  Interhack Corp  +1 614 545 HACK http://web.interhack.com/
Author,  Developing Trust: Online Privacy and Security  (Apress, 2001)
Knight, Lambda Calculus | Certum quod factum. --Giovanni Battista Vico
From: Bill Clementson
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <wkadsx4p0j.fsf@attbi.com>
·······@flop.co.uk (Andy Reiter) writes:

> My first post in here. I am learning Lisp on my own (but I am an
> experienced
> programmer otherwise) I am running Windows 98, and Clisp 2.27,
> installed from
> the binary.

You might want to have a look at the CL Cookbook - it has a lot of information
that you might find useful. It has a chapter (that I wrote) on setting up 
emacs with a number of popular lisp implementations on MS Windows. The 
combination of emacs, ilisp, Hyperspec & a lisp impelementation make for
a pretty nice lisp development environment. The page is at:
http://cl-cookbook.sourceforge.net/windows.html

> I have "Winston & Worn", CLtL2, and -thanks Paul- "On Lisp". I also
> read every
> other online publication I could lay my hands on.

You didn't mention the Hyperspec - that is pretty essential as CLtL2 is 
out-of-date in respects to some parts of ANSI CL. A link to the downloadable
version of the hyperspec is on the CL Cookbook page.
 
> 1) How do I get network/regex/database access from within my code? In

CLISP has both regex and socket support. You might want to read the 
impnotes.html file in the clisp doc directory - it describes the regex
and socket support in clisp.

> Perl, and
> most other languages, I import a package, and use all the function,
> and data-structures defined in the namespace.
> I have seen the chapter on packages in CLtL2, but I really don't grok
> it. The
> Package->symbol naming convention doesn't seem standarized. Please
> tell me
> where are the packages, within the installation directory, and how can
> I call
> them?
> Am I wrong in looking for "physical" packages? C/C++ has #include REAL
> files,
> which I can read modify and learn from. Also Java/Perl/Python
> import/use REAL files.
> CLISP doesn't seem to have a "lib" or "include" directory, where I can
> go to,
> and see what is there.

The standard packages are all pre-included in the lisp image that comes
with the clisp binary distribution. In the src directory of the binary
distribution, there is the lisp source code.

> 2) What is the CLISPly correct way to organize your code? I see there
> isn't any
> seperation of defenition and declaration -Lisp has a badass way of
> solving forward references- but how do I split my code into
> functions/variables/structs/classes/macros?
> Does each belong to its own file? what do I name those file?
> 
> I saw the CLISP sources, and there are *.d files. They look like
> generated/pre-processed code. What are they?
> 
> 3) I am well versed in OOP, but also, I am well versed in C/procedural
> coding.
>  Were does Lisp stand, inbetween the two?
> I was told that global variables were bad, but I have seen
> Winston&Horn define
> a global variable and write functions that manipulate it. Is that the
> big'' picture of Lisp coding, or is it just a vehicle for teaching.
> 
> In C, I make sure to put any necessary global variables in a
> structure, and
> pad an special prefix to it, to make it stand out.
> Are Lisp's global variables, OK in the sense that they are only used
> for BIG
> data structures, or is it customary to have tiny little flags/integers
> float around, in the code.

Others will be able to give you better answers on questions #2 & #3.

> 4) Ctags, Ctags, Ctags. I am starting to learn Emacs just for Lisp
> coding. I
> saw "etags" in the emacs directory, and have seen some tutorials on
> how to use
> it with C code. Can some good soul show me the keys I need to press,
> to have
> emacs show me the defenition of a variable, wethere some car is a
> function or
> macro, the expanssion of a macro, etc.

Here are the steps for using etags:
1. Make sure etags.exe is in your path
2. In emacs, do the following:
        a. Go to directory containing the lisp source files
        b. Press: "M-!"
        c. At the "Shell command:" prompt enter "etags *.lisp"
           This will result in a TAGS file being created in the directory
        d. Open a lisp file in the directory & press "M-." when on a symbol
           You will be taken to the symbol definition. 

There's more to creating & using tag files, but that should help you get 
started.

Macroexpand & macroexpand-1 are standard functions and there are ILISP
shortcut keys for them (see ILISP install instructions in CL Cookbook 
page).

> 5) I use CLISP directly from within emacs -I know neither well- is
> there some
> way I can rename "DESCRIBE" and "APROPOS" to something shorter? those
> are my
> most used functions :-D

If you install ILISP (refer to the CL Cookbook page), there are shortcut
keys that you can use for DESCRIBE, APROPOS, INSPECT, etc.

> 6) Is there some document on how to use the chunk of CMUCL libraries
> with CLISP?
> I know what to change, in order to make a Borland C code compile on
> DJGPP. This
> varies from rewriting the makefile, (re|un)defining some macros, to
> recompiling
> an entire libarary, and even changing the calling convention of some
> functions.
> Is there are compatibility layers between CLISP and CMUCL? something
> like "oh, just use the Makefile.clisp" to "don't touch that, it knows
> about the CMUCL FFI
> and expects the function __rekhavok.

You might want to look at a reasonably large cross-platform system like
CLOCC to see how others handle implementation differences. CLOCC is at:
http://clocc.sourceforge.net/

> 7) Lisp rules :-)

True :-)

> I see between the ()s, and I think in prefix. Besides, it gave a
> myriad of
> short and interesting function/macro names, that I can use in my C
> code. A very
> compact, but complete naming convention :-)

Not sure what the question was in #7. 

Good luck with Lisp.

--
Bill Clementson
From: Luke J Crook
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <_6Wn8.842$401.1856549@twister.socal.rr.com>
I attempted to configure my emacs by following your instructions: here is
what I found.

2) Installing CLISP
 - The install.bat file for version 2.28 worked perfectly under Windows XP
 - clisp-indent.el is now included in the ZIP
 - with these in mind, there was no need to download from CVS

6. Installing additional Emacs utilities
 - I received this message when attempting to download iLisp from CVS

cvs.exe login: authorization failed: server cvs.ILISP.sourceforge.net
rejected a
ccess to /cvsroot/ILISP for user anonymous

So I continued on using the iLisp tarball....

I received the following error when loading Emacs (runemacs.exe)

File error: "Cannot open load file", "c:/home/site/ilisp/extra/cltl2"

The "c:/home/site/ilisp/extra/" directory contains the hyperspec .en's, but
not the cltl2 .en's . Assumed that this was because I used the iLisp tarball
as explained above?

I received the following error when attempting to compile the .emacs file:

Compiling file c:/home/.emacs at Mon Mar 25 23:44:09 2002
  !! File error (("Cannot open load file" "fi-site-init"))

Could you give me a few pointers so I can carry on with the install ?

-Luke


"Bill Clementson" <·······@attbi.com> wrote in message
···················@attbi.com...
> ·······@flop.co.uk (Andy Reiter) writes:
>
> > My first post in here. I am learning Lisp on my own (but I am an
> > experienced
> > programmer otherwise) I am running Windows 98, and Clisp 2.27,
> > installed from
> > the binary.
>
> You might want to have a look at the CL Cookbook - it has a lot of
information
> that you might find useful. It has a chapter (that I wrote) on setting up
> emacs with a number of popular lisp implementations on MS Windows. The
> combination of emacs, ilisp, Hyperspec & a lisp impelementation make for
> a pretty nice lisp development environment. The page is at:
> http://cl-cookbook.sourceforge.net/windows.html
>
> > I have "Winston & Worn", CLtL2, and -thanks Paul- "On Lisp". I also
> > read every
> > other online publication I could lay my hands on.
>
> You didn't mention the Hyperspec - that is pretty essential as CLtL2 is
> out-of-date in respects to some parts of ANSI CL. A link to the
downloadable
> version of the hyperspec is on the CL Cookbook page.
>
> > 1) How do I get network/regex/database access from within my code? In
>
> CLISP has both regex and socket support. You might want to read the
> impnotes.html file in the clisp doc directory - it describes the regex
> and socket support in clisp.
>
> > Perl, and
> > most other languages, I import a package, and use all the function,
> > and data-structures defined in the namespace.
> > I have seen the chapter on packages in CLtL2, but I really don't grok
> > it. The
> > Package->symbol naming convention doesn't seem standarized. Please
> > tell me
> > where are the packages, within the installation directory, and how can
> > I call
> > them?
> > Am I wrong in looking for "physical" packages? C/C++ has #include REAL
> > files,
> > which I can read modify and learn from. Also Java/Perl/Python
> > import/use REAL files.
> > CLISP doesn't seem to have a "lib" or "include" directory, where I can
> > go to,
> > and see what is there.
>
> The standard packages are all pre-included in the lisp image that comes
> with the clisp binary distribution. In the src directory of the binary
> distribution, there is the lisp source code.
>
> > 2) What is the CLISPly correct way to organize your code? I see there
> > isn't any
> > seperation of defenition and declaration -Lisp has a badass way of
> > solving forward references- but how do I split my code into
> > functions/variables/structs/classes/macros?
> > Does each belong to its own file? what do I name those file?
> >
> > I saw the CLISP sources, and there are *.d files. They look like
> > generated/pre-processed code. What are they?
> >
> > 3) I am well versed in OOP, but also, I am well versed in C/procedural
> > coding.
> >  Were does Lisp stand, inbetween the two?
> > I was told that global variables were bad, but I have seen
> > Winston&Horn define
> > a global variable and write functions that manipulate it. Is that the
> > big'' picture of Lisp coding, or is it just a vehicle for teaching.
> >
> > In C, I make sure to put any necessary global variables in a
> > structure, and
> > pad an special prefix to it, to make it stand out.
> > Are Lisp's global variables, OK in the sense that they are only used
> > for BIG
> > data structures, or is it customary to have tiny little flags/integers
> > float around, in the code.
>
> Others will be able to give you better answers on questions #2 & #3.
>
> > 4) Ctags, Ctags, Ctags. I am starting to learn Emacs just for Lisp
> > coding. I
> > saw "etags" in the emacs directory, and have seen some tutorials on
> > how to use
> > it with C code. Can some good soul show me the keys I need to press,
> > to have
> > emacs show me the defenition of a variable, wethere some car is a
> > function or
> > macro, the expanssion of a macro, etc.
>
> Here are the steps for using etags:
> 1. Make sure etags.exe is in your path
> 2. In emacs, do the following:
>         a. Go to directory containing the lisp source files
>         b. Press: "M-!"
>         c. At the "Shell command:" prompt enter "etags *.lisp"
>            This will result in a TAGS file being created in the directory
>         d. Open a lisp file in the directory & press "M-." when on a
symbol
>            You will be taken to the symbol definition.
>
> There's more to creating & using tag files, but that should help you get
> started.
>
> Macroexpand & macroexpand-1 are standard functions and there are ILISP
> shortcut keys for them (see ILISP install instructions in CL Cookbook
> page).
>
> > 5) I use CLISP directly from within emacs -I know neither well- is
> > there some
> > way I can rename "DESCRIBE" and "APROPOS" to something shorter? those
> > are my
> > most used functions :-D
>
> If you install ILISP (refer to the CL Cookbook page), there are shortcut
> keys that you can use for DESCRIBE, APROPOS, INSPECT, etc.
>
> > 6) Is there some document on how to use the chunk of CMUCL libraries
> > with CLISP?
> > I know what to change, in order to make a Borland C code compile on
> > DJGPP. This
> > varies from rewriting the makefile, (re|un)defining some macros, to
> > recompiling
> > an entire libarary, and even changing the calling convention of some
> > functions.
> > Is there are compatibility layers between CLISP and CMUCL? something
> > like "oh, just use the Makefile.clisp" to "don't touch that, it knows
> > about the CMUCL FFI
> > and expects the function __rekhavok.
>
> You might want to look at a reasonably large cross-platform system like
> CLOCC to see how others handle implementation differences. CLOCC is at:
> http://clocc.sourceforge.net/
>
> > 7) Lisp rules :-)
>
> True :-)
>
> > I see between the ()s, and I think in prefix. Besides, it gave a
> > myriad of
> > short and interesting function/macro names, that I can use in my C
> > code. A very
> > compact, but complete naming convention :-)
>
> Not sure what the question was in #7.
>
> Good luck with Lisp.
>
> --
> Bill Clementson
From: Bill Clementson
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <wk3cym4o8c.fsf@attbi.com>
"Luke J Crook" <······@socal.rr.com> writes:

> I attempted to configure my emacs by following your instructions: here is
> what I found.
> 
> 2) Installing CLISP
>  - The install.bat file for version 2.28 worked perfectly under Windows XP
>  - clisp-indent.el is now included in the ZIP
>  - with these in mind, there was no need to download from CVS

Yes, I know, my instructions were for the 2.27 version of CLISP and I 
haven't updated them yet for 2.28. 

> 
> 6. Installing additional Emacs utilities
>  - I received this message when attempting to download iLisp from CVS
> 
> cvs.exe login: authorization failed: server cvs.ILISP.sourceforge.net
> rejected a
> ccess to /cvsroot/ILISP for user anonymous

The server seems to sometimes reject anonymous logins. Not sure why, but 
I can sometimes do a cvs checkout and sometimes not. If you try again 
later, you might be lucky. Alternatively, You can try downloading the 
ilisp cvs tarball.

> So I continued on using the iLisp tarball....

which you did ...

> I received the following error when loading Emacs (runemacs.exe)
> 
> File error: "Cannot open load file", "c:/home/site/ilisp/extra/cltl2"
> 
> The "c:/home/site/ilisp/extra/" directory contains the hyperspec .en's, but
> not the cltl2 .en's . Assumed that this was because I used the iLisp tarball
> as explained above?

Did you download the cvs tarball or the standard 5.11 distribution? If you 
downloaded the 5.11 distribution, that won't work properly with emacs 21.1 and
it definitely doesn't have the cltl2 file in it. If you downloaded the cvs 
tarball, remember that it is a copy of the cvs repository and you still 
need to do an extract of the files from the repository directories.

> I received the following error when attempting to compile the .emacs file:
> 
> Compiling file c:/home/.emacs at Mon Mar 25 23:44:09 2002
>   !! File error (("Cannot open load file" "fi-site-init"))

Maybe you didn't download acl into the specified directory (c:/Program Files/acl).
If you didn't, you will need to change the value of the fi:common-lisp-directory 
variable at the beginning of the .emacs file.
 
> 
> Could you give me a few pointers so I can carry on with the install ?

Hope that helps - let me know if you have any more problems.

--
Bill Clementson
From: Luke J Crook
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <%Kzo8.3125$VQ2.903351@twister.socal.rr.com>
"Bill Clementson" <·······@attbi.com> wrote in message
···················@attbi.com...
> "Luke J Crook" <······@socal.rr.com> writes:
>
> > 6. Installing additional Emacs utilities
> >  - I received this message when attempting to download iLisp from CVS
> >
> > cvs.exe login: authorization failed: server cvs.ILISP.sourceforge.net
> > rejected a
> > ccess to /cvsroot/ILISP for user anonymous
>
> The server seems to sometimes reject anonymous logins. Not sure why, but
> I can sometimes do a cvs checkout and sometimes not. If you try again
> later, you might be lucky. Alternatively, You can try downloading the
> ilisp cvs tarball.

Still unable to login to the server, see below

>
> > I received the following error when loading Emacs (runemacs.exe)
> >
> > File error: "Cannot open load file", "c:/home/site/ilisp/extra/cltl2"
> >
> Did you download the cvs tarball or the standard 5.11 distribution?

I downloaded the 5.11 distro, not the CVS tarball. Oh, woe. I ended up
browsing the iLISP CVS directory on sourceforge and downloading the cltl2
file directly.... so far so good.

> > I received the following error when attempting to compile the .emacs
file:
> >
> > Compiling file c:/home/.emacs at Mon Mar 25 23:44:09 2002
> >   !! File error (("Cannot open load file" "fi-site-init"))
>
> Maybe you didn't download acl into the specified directory (c:/Program
Files/acl).

No, I downloaded ILISP.

> If you didn't, you will need to change the value of the
fi:common-lisp-directory
> variable at the beginning of the .emacs file.
>

I'm not sure I understand...

;; Franz Allegro Common Lisp - ELI
(defvar fi:common-lisp-image-name "C:/Program Files/ACL/allegro-ansi.exe")
(defvar fi:common-lisp-directory "C:/Program Files/ACL/")

The "fi:common-lisp-directory" is under the ACL defaults... however I am
using CLISP.... Is it required that I have to download and install ACL to
get the .emacs file to compile ? The way you have explained it is that the
user has the choice of downloading any LISP environment.

-Luke Crook
From: Luke J Crook
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <2Ozo8.3157$VQ2.906340@twister.socal.rr.com>
"Luke J Crook" <······@socal.rr.com> wrote in message
··························@twister.socal.rr.com...
> "Bill Clementson" <·······@attbi.com> wrote in message
> ···················@attbi.com...
> > "Luke J Crook" <······@socal.rr.com> writes:

> No, I downloaded ILISP.

Arg.. I meant CLISP for the above.

> -Luke Crook
>
>
From: Bill Clementson
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <wkbsd8zjmb.fsf@attbi.com>
"Luke J Crook" <······@socal.rr.com> writes:

> I downloaded the 5.11 distro, not the CVS tarball. Oh, woe. I ended up
> browsing the iLISP CVS directory on sourceforge and downloading the cltl2
> file directly.... so far so good.

The 5.11 distro might work ok some of the times with emacs 21.1, but the 
maintainers recommend that you take the cvs version. 

> The "fi:common-lisp-directory" is under the ACL defaults... however I am
> using CLISP.... Is it required that I have to download and install ACL to
> get the .emacs file to compile ? The way you have explained it is that the
> user has the choice of downloading any LISP environment.

If you don't want to download acl, you will need to comment out the 2 fi-site-init
loads in the .emacs file in order to get it to compile. The lines are #63 (you 
will need to move the terminating ")" up to line #62 and lines 218-225.

--
Bill Clementson
From: Luke Crook
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <a82sg7$cpq@dispatch.concentric.net>
OK, I'm getting there... :)

As per your instructions everything now compiles, thank you. The next hurdle
thrown up is this..

;; Loading file C:\home\_clisprc.lisp ...
;; Loading of file C:\home\_clisprc.lisp is finished.
[1]>
[2]> ;;; Loading c:/home/site/ilisp/cl-ilisp.lisp
ILISP: File is not compiled, use M-x ilisp-compile-inits
[7]> ;;; Loading c:/home/site/ilisp/cl-chs-init.lisp
ILISP: File is not compiled, use M-x ilisp-compile-inits

Following your instructions, I type: M-x ilisp-compile-inits , but get this

M-x ilisp-compile-inits (no match)

FYI: I am still unable to login to the ilisp CVS, so I downloaded just your
icompile.bat file and ran that with the 5.11 distro. icompile.bat halts at
the following line:

Formatting: Switching buffers ...

The CPU pegs at maximum and the batch file goes no further.

Regards,
-Luke



"Bill Clementson" <·······@attbi.com> wrote in message
···················@attbi.com...
> "Luke J Crook" <······@socal.rr.com> writes:
>
> > I downloaded the 5.11 distro, not the CVS tarball. Oh, woe. I ended up
> > browsing the iLISP CVS directory on sourceforge and downloading the
cltl2
> > file directly.... so far so good.
>
> The 5.11 distro might work ok some of the times with emacs 21.1, but the
> maintainers recommend that you take the cvs version.
>
> > The "fi:common-lisp-directory" is under the ACL defaults... however I am
> > using CLISP.... Is it required that I have to download and install ACL
to
> > get the .emacs file to compile ? The way you have explained it is that
the
> > user has the choice of downloading any LISP environment.
>
> If you don't want to download acl, you will need to comment out the 2
fi-site-init
> loads in the .emacs file in order to get it to compile. The lines are #63
(you
> will need to move the terminating ")" up to line #62 and lines 218-225.
>
> --
> Bill Clementson
From: Luke Crook
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <a82us7$cpu@dispatch.concentric.net>
Success, everything works just fine :)

The problem I was having did indeed result from me using the "icompile.bat"
file on the iLisp 5.11 distro... It has to be run from within the CVS
directory. Your iLisp CVS login commands are not entirely correct....
'ILISP' is not meant to be capitalized, see
http://sourceforge.net/cvs/?group_id=3957 and the "CVS" page.

The correct CVS login commands are:

cvs ····················@cvs.ilisp.sourceforge.net:/cvsroot/ilisp login
cvs -z3 ····················@cvs.ilisp.sourceforge.net:/cvsroot/ilisp co
ilisp

If I may suggest a couple of corrections / additions to your Howto:

1) Correct the CVS entry as described above
2) Add the following from your previous post.... (it will help people like
me who only install CLISP.)

"If you don't want to download acl, you will need to comment out the 2
fi-site-init
loads in the .emacs file in order to get it to compile. The lines are #63
(you
will need to move the terminating ")" up to line #62 and lines 218-225."

3) Make a note that the install.bat file for CLISP version 2.28 works under
Windows XP.
4) clisp-indent.el is included in the CLISP 2.28 ZIP

Those are all my comments. Hope they are helpful to you. And thanks again
for all your help.

-Luke Crook
From: Bill Clementson
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <wkk7ruo7za.fsf@attbi.com>
"Luke Crook" <······@wsbnet.com> writes:

> Success, everything works just fine :)

Glad to hear that you finally got things working.

> The problem I was having did indeed result from me using the "icompile.bat"
> file on the iLisp 5.11 distro... It has to be run from within the CVS
> directory. Your iLisp CVS login commands are not entirely correct....
> 'ILISP' is not meant to be capitalized, see
> http://sourceforge.net/cvs/?group_id=3957 and the "CVS" page.
> 
> The correct CVS login commands are:
> 
> cvs ····················@cvs.ilisp.sourceforge.net:/cvsroot/ilisp login
> cvs -z3 ····················@cvs.ilisp.sourceforge.net:/cvsroot/ilisp co
> ilisp

Thanks for picking that up. I must have done a global replace of "ilisp" to
"ILISP" at some stage.

> If I may suggest a couple of corrections / additions to your Howto:
> 
> 1) Correct the CVS entry as described above
> 2) Add the following from your previous post.... (it will help people like
> me who only install CLISP.)
> 
> "If you don't want to download acl, you will need to comment out the 2
> fi-site-init
> loads in the .emacs file in order to get it to compile. The lines are #63
> (you
> will need to move the terminating ")" up to line #62 and lines 218-225."
> 
> 3) Make a note that the install.bat file for CLISP version 2.28 works under
> Windows XP.
> 4) clisp-indent.el is included in the CLISP 2.28 ZIP
> 
> Those are all my comments. Hope they are helpful to you. And thanks again
> for all your help.

Thanks for your comments and suggestions. I will update the page with the
corrections/suggestions you listed.

--
Bill Clementson
From: Luke Crook
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <a832v3$cpt@dispatch.concentric.net>
Bill,

I hope you don't mind, but I have one other question about the environment..

When I open your .emacs file and select a function with the mouse, a
definition appears in the output window, e.g. SETQ: (SYM VAL SYM VAL) etc. I
believe this is something that cltl2 provides.

However this only works on the .emacs file and not one any of my files with
the extensions , .LSP or .LISP. I think this has something to do with .emacs
being identified as an "Emacs-Lisp" file and .LISP being identified as a
"Lisp" file.

Is there a way I get cltl2 to parse "Lisp" files ?

-Luke
From: Bill Clementson
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <wkg02io7sw.fsf@attbi.com>
"Luke Crook" <······@wsbnet.com> writes:

> When I open your .emacs file and select a function with the mouse, a
> definition appears in the output window, e.g. SETQ: (SYM VAL SYM VAL) etc. 
> I believe this is something that cltl2 provides.

This actually doesn't have anything to do with cltl2 - it is done by eldoc
which is loaded as part of the emacs-lisp-mode-hook in the sample .emacs 
file.

> However this only works on the .emacs file and not one any of my files with
> the extensions , .LSP or .LISP. I think this has something to do with .emacs
> being identified as an "Emacs-Lisp" file and .LISP being identified as a
> "Lisp" file.
>
> Is there a way I get cltl2 to parse "Lisp" files ?

There is actually a similar feature enabled with ilisp; however, it doesn't
show the function parameter list when you click on the function with the 
mouse, only when you type in the function name and press the space key. 
It is enabled in the .emacs file by the ilisp-*arglist-message-lisp-space-p* 
variable. It isn't quite as nice as eldoc but it is more accurate for 
Common Lisp.

As I mentioned above, cltl2.el doesn't have anything to do with this - it is
used for displaying  the CLtL2 documentation. (e.g. - If you place the cursor 
on a standard lisp function name (e.g. - "require") and press "F1", then 
hyperspec.el will bring up the page in the Hyperspec documentation for that 
function. If you press "M-F1" instead, then cltl2.el will bring up the relevant 
page in the CLtL2 documentation. The Hyperspec is the more correct documentation 
but sometimes the CLtL2 documentation adds some additional insights that aren't 
in the Hyperspec.)

Hope that clears things up.

Regards,
Bill
From: Dorai Sitaram
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <a80067$mrc$1@news.gte.com>
If I may add a few mg to this ton, 

1. CLISP's compile-file seems to require that its
argument be a filename with extension (ie, a
filename whose pathname-type is non-nil).  Is
this restriction acceptable, and if so, is there a
workaround to force compile-file to accept an
extensionless filename?

2. Is there some switch/whatever I can set so
that CLISP's trace uses variable indentation in
addition to or instead of numbering?

--d
From: Sam Steingold
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <m3n0wrma1q.fsf@gnu.org>
> * In message <············@news.gte.com>
> * On the subject of "Re: A ton of CLISP questions."
> * Sent on 28 Mar 2002 20:58:47 GMT
> * Honorable ····@goldshoe.gte.com (Dorai Sitaram) writes:
>
> If I may add a few mg to this ton, 
> 
> 1. CLISP's compile-file seems to require that its argument be a
> filename with extension (ie, a filename whose pathname-type is
> non-nil).

this is not the case:

[1]> (compile-file "~/lisp/init")

Compiling file /home/sds/lisp/init.lisp ...

Compilation of file /home/sds/lisp/init.lisp is finished.
0 errors, 0 warnings
#P"/home/sds/lisp/init.fas" ;
nil ;
nil
[2]>

> 2. Is there some switch/whatever I can set so that CLISP's trace uses
> variable indentation in addition to or instead of numbering?

sounds good - will be there in the next version.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
nobody's life, liberty or property are safe while the legislature is in session
From: Dorai Sitaram
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <a82h29$oh4$1@news.gte.com>
In article <··············@gnu.org>, Sam Steingold  <···@gnu.org> wrote:
>> * Honorable ····@goldshoe.gte.com (Dorai Sitaram) writes:
>>
>> 1. CLISP's compile-file seems to require that its argument be a
>> filename with extension (ie, a filename whose pathname-type is
>> non-nil).
>
>this is not the case:
>
>[1]> (compile-file "~/lisp/init")
>
>Compiling file /home/sds/lisp/init.lisp ...
>
>Compilation of file /home/sds/lisp/init.lisp is finished.
>0 errors, 0 warnings
>#P"/home/sds/lisp/init.fas" ;
>nil ;
>nil
>[2]>

I didn't mean an extension wasn't being inferred
when the file does have an extension; rather a file
that really had no extension at all wasn't being
recognized as a valid input file by compile-file. 

If I had a file named just "init" but no "init.lisp",
then compile-file of "init" bombs saying it couldn't
find "init.lisp".

>> 2. Is there some switch/whatever I can set so that CLISP's trace uses
>> variable indentation in addition to or instead of numbering?
>
>sounds good - will be there in the next version.

Thanks!

--d
From: Sam Steingold
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <m3g02gium0.fsf@gnu.org>
> * In message <············@news.gte.com>
> * On the subject of "Re: A ton of CLISP questions."
> * Sent on 29 Mar 2002 19:59:05 GMT
> * Honorable ····@goldshoe.gte.com (Dorai Sitaram) writes:
>
> If I had a file named just "init" but no "init.lisp",
> then compile-file of "init" bombs saying it couldn't
> find "init.lisp".

what happens when you do
        (push #p"" *source-file-types*)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
If Perl is the solution, you're solving the wrong problem. - Erik Naggum
From: Dorai Sitaram
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <a89ro9$7m1$1@news.gte.com>
In article <··············@gnu.org>, Sam Steingold  <···@gnu.org> wrote:
>> * Honorable ····@goldshoe.gte.com (Dorai Sitaram) writes:
>>
>> If I had a file named just "init" but no "init.lisp",
>> then compile-file of "init" bombs saying it couldn't
>> find "init.lisp".
>
>what happens when you do
>        (push #p"" *source-file-types*)
>

I continue to see compile-file failing the way I
described on CLISP 2.27 (Linux, where downloading
speed prevents me from upgrading often), but it works
just fine on 2.28 (Solaris, NT). 

Thanks!
From: Thomas A. Russ
Subject: Re: A ton of CLISP questions.
Date: 
Message-ID: <ymi3cyoe10b.fsf@sevak.isi.edu>
·······@flop.co.uk (Andy Reiter) writes:

> Here are my questions:
> 
> 1) How do I get network/regex/database access from within my code? In
> Perl, and most other languages, I import a package, and use all the
> function, and data-structures defined in the namespace.

For lisps other than CLisp, there are generally extensions either in the
Lisp or portable ones available to provide such access.

> I have seen
> the chapter on packages in CLtL2, but I really don't grok it. The
> Package->symbol naming convention doesn't seem standarized.

Well, packages in lisp are different from the code or functionality
packages that you are referring to in other languages.  In Lisp packages
are solely used to manage the namespace.  Each package establishes its
own mapping from symbol names to symbol objects.  (The Lisp reader uses
this mapping to assure that (interned) symbols in the same package with
the same name map to the same symbol object).  I won't go into
uninterned symbols right now.

Now, it so happens that most code groups typically come with their own
package definitions, so as not to accidentally redefine other people's
functions.  It is used to manage the namespace.  Unlike in Java, there
isn't any global naming scheme for packages (which is why often
multiple, different regular expression implementations may all choose to
use the package named REGEX).

> Please
> tell me where are the packages, within the installation directory, and
> how can I call them?  Am I wrong in looking for "physical" packages?
> C/C++ has #include REAL files, which I can read modify and learn
> from. Also Java/Perl/Python import/use REAL files.  CLISP doesn't seem
> to have a "lib" or "include" directory, where I can go to, and see
> what is there.

Other places to look are at the cmu-cl archive (I don't have the URL for
that handy right now), and at the ALU (Association of Lisp Users)
web site: www.alu.org 

> 2) What is the CLISPly correct way to organize your code? I see there
> isn't any
> seperation of defenition and declaration -Lisp has a badass way of
> solving forward references- but how do I split my code into
> functions/variables/structs/classes/macros?
> Does each belong to its own file? what do I name those file?

Well, there are different conventions.  Here are the sequencing
requirements:
 - macros must be defined before they are used.
 - Defstructs also need to be defined before use.
 - Classes usually need to be defined before methods on them are written.P
 - Special variables need to be declared (or at least declaimed special)
   before they are bound.

Other than that, you are free to structure your code in a way that makes
sense for the logical breakdown of your application.  One benefit of the
flexibility is that you could, for example, group all the methods for a
particular generic function together rather than parceling them out
amongst their respective classes.

Something else to look at is the DEFSYSTEM facility.  Marco Antoniotti
has been working on extending and bringing Mark Kantrowitz's portable
defsystem code up to date.  It is a lisp-based system that essentially
does a lot of what makefiles do for C.

> I saw the CLISP sources, and there are *.d files. They look like
> generated/pre-processed code. What are they?
> 
> 3) I am well versed in OOP, but also, I am well versed in C/procedural
> coding.
>  Were does Lisp stand, inbetween the two?
> I was told that global variables were bad, but I have seen
> Winston&Horn define
> a global variable and write functions that manipulate it. Is that the
> big'' picture of Lisp coding, or is it just a vehicle for teaching.

Well, Lisp can do all of that.  In some ways, Lisp is much more
obejct-centric (to borrown Kent Pitman's phrase), in that all things in
Lisp know their identity.  This includes the built-in data types like
characters, integers and floats.  That is why you can do dynamic type
dispatch on the built-in entities as well.

> In C, I make sure to put any necessary global variables in a
> structure, and
> pad an special prefix to it, to make it stand out.
> Are Lisp's global variables, OK in the sense that they are only used
> for BIG
> data structures, or is it customary to have tiny little flags/integers
> float around, in the code.

It varies.  There are a number of built-in special (global) variables
that control things like printing and reading of forms.  The general
convention is that special variables have names that start and end with
as asterisk, for example *PRINT-CIRCLE*.  This helps them to stand out.
One nice feature is the way they interact with the LET binding form to
allow you to temporarily change the value, and then automatically
restore the old value upon exit from the form.

As for style, it really depends on how you use them -- like any global
data structure (or most any programming construct), they can be used
well or abused.  For multi-processing, most Lisps keep the binidings as
process-local changes to the value -- although there are ways around
this so that they can be used for interprocess communication.



-- 
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu