From: Eli Bendersky
Subject: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186547718.611430.86650@22g2000hsm.googlegroups.com>
Hello,

My question pertains to CLISP on Windows. I'm looking for an accepted
way to have some libraries (downloaded from the web, for instance)
permanently available in my CL coding with CLISP. For example the ASDF
library which isn't preinstalled with CLISP but can be easily obtained
as a single .lisp file online. How can I make ASDF always available
for my lisp code ? What is the best way to achieve this ?

Thanks in advance
Eli

From: Rob Warnock
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <QeSdnWJ1wOBYGSTbnZ2dnUVZ_g6dnZ2d@speakeasy.net>
Eli Bendersky  <······@gmail.com> wrote:
+---------------
| My question pertains to CLISP on Windows. I'm looking for an accepted
| way to have some libraries (downloaded from the web, for instance)
| permanently available in my CL coding with CLISP. For example the ASDF
| library which isn't preinstalled with CLISP but can be easily obtained
| as a single .lisp file online. How can I make ASDF always available
| for my lisp code ? What is the best way to achieve this ?
+---------------

The classic method for *most* Lisps, not just CLISP, is to load
everything you want into a running Lisp image, save the image, and
then move the default Lisp image out of the way and replace it with
the one you just saved. You will probably want to make the "initial
function" of your custom image do (most of) the same things the
default initial function does, e.g., parse command-line options,
start a top-level REPL, etc., so it behaves just like a standard
image, except it's got more "stuff" in it. [But you can also use
this opportunity to add some special command-line options of your
own, if you like.]

For CLISP, the function to look at is SAVEINITMEM; for CMUCL,
it's SAVE-LISP; for SBCL it's SB-EXT:SAVE-LISP-AND-DIE, etc.
<http://www.faqs.org/faqs/lisp-faq/part2/section-11.html> has
a longer list [possibly out of date].


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Eli Bendersky
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186577578.494723.97830@o61g2000hsh.googlegroups.com>
On Aug 8, 10:54 am, ····@rpw3.org (Rob Warnock) wrote:
> Eli Bendersky  <······@gmail.com> wrote:
> +---------------
> | My question pertains to CLISP on Windows. I'm looking for an accepted
> | way to have some libraries (downloaded from the web, for instance)
> | permanently available in my CL coding with CLISP. For example the ASDF
> | library which isn't preinstalled with CLISP but can be easily obtained
> | as a single .lisp file online. How can I make ASDF always available
> | for my lisp code ? What is the best way to achieve this ?
> +---------------
>
> The classic method for *most* Lisps, not just CLISP, is to load
> everything you want into a running Lisp image, save the image, and
> then move the default Lisp image out of the way and replace it with
> the one you just saved. You will probably want to make the "initial
> function" of your custom image do (most of) the same things the
> default initial function does, e.g., parse command-line options,
> start a top-level REPL, etc., so it behaves just like a standard
> image, except it's got more "stuff" in it. [But you can also use
> this opportunity to add some special command-line options of your
> own, if you like.]
>
> For CLISP, the function to look at is SAVEINITMEM; for CMUCL,
> it's SAVE-LISP; for SBCL it's SB-EXT:SAVE-LISP-AND-DIE, etc.
> <http://www.faqs.org/faqs/lisp-faq/part2/section-11.html> has
> a longer list [possibly out of date].

Thanks for your answer.
It certainly is an unusual approach, when compared with other
languages and systems. I see some advantages and disadvantages - for
example, I have to manually recreate the image each time I have a new
module installed. Also, if for some reason the image goes wrong I have
to re-load *everything* manually again to recreate it.

Are there alternative approaches, perhaps closer to the "common"
method of a central installation of which every invocation is aware ?

Thanks in advance
Eli
From: Matthias Benkard
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186588310.766617.309520@d55g2000hsg.googlegroups.com>
Hi,


> Are there alternative approaches, perhaps closer to the "common"
> method of a central installation of which every invocation is aware ?

Hmm.  Every invocation of what?

I don't know how knowledgable you are about Common Lisp and whether it
is evident to you that what Common Lisp calls packages and what you
call libraries are completely orthogonal to each other.  Because of
this orthoganlity, it would be very difficult to make systems
(libraries) auto-loadable ala Python and Ruby based on some convention
for package names.

If you want to have a set of systems available at all times, they must
be loaded whenever you start a Lisp session.  This can be accomplished
by either creating a core image with all the systems preloaded, as Rob
suggested, or by writing an initialisation script that is
automatically run by your Lisp implementation (which would probably be
much easier to maintain than having to create a new core image after
every library update).  For CLISP, this would be, I think, a file
called .clisprc.lisp in your home directory.  It might look like this
(caution: not tested!):

  (load "/home/mulk/Downloads/Systems/ASDF/asdf.lisp")
  (push #p"/home/mulk/.clc/systems" asdf:*central-registry*)
  (dolist (system-name '(:cl-ppcre :split-sequence :iterate))
    (asdf:oos 'asdf:load-op system-name))

This example utilises the fact that ASDF maintains a set of central
directories that it searches when you ask it to load a system, here
manually extended with the directory /home/mulk/.clc/systems.  Maybe
this is what you meant by "a central installation"?  Try symlinking
(not copying!) all your .asd files to ~/.clc/systems and putting the
above in your .clisprc file (replacing all occurences of "/home/mulk"
with your home directory) in order to load the ASDF systems CL-PPCRE,
SPLIT-SEQUENCE and ITERATE on every CLISP session start.

If you're using Windows, symlinking files will obviously not work.  In
that case, you can try something like the following (caution: even
less tested :)):

  (load "/home/mulk/Downloads/Systems/ASDF/asdf.lisp")
  (dolist (subdir (directory #"/home/mulk/.clc/systems/*"))
    (push subdir asdf:*central-registry*))
  (dolist (system-name '(:cl-ppcre :split-sequence :iterate))
    (asdf:oos 'asdf:load-op system-name))

And put your downloaded libraries as subdirectories into /home/
mulk/.clc/systems/ (in this example).

I'm not all that familiar with using ASDF on Windows or using .clisprc
to load systems that you frequently need, but I hope these examples
help a little (I also hope they're not completely wrong. :)).

Mata ne,
Matthias
From: Eli Bendersky
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186591988.895047.286730@l70g2000hse.googlegroups.com>
On Aug 8, 5:51 pm, Matthias Benkard <··········@gmail.com> wrote:
> Hi,
>
> > Are there alternative approaches, perhaps closer to the "common"
> > method of a central installation of which every invocation is aware ?
>
> Hmm.  Every invocation of what?
>
> I don't know how knowledgable you are about Common Lisp and whether it
> is evident to you that what Common Lisp calls packages and what you
> call libraries are completely orthogonal to each other.  Because of
> this orthoganlity, it would be very difficult to make systems
> (libraries) auto-loadable ala Python and Ruby based on some convention
> for package names.
>
> If you want to have a set of systems available at all times, they must
> be loaded whenever you start a Lisp session.  This can be accomplished
> by either creating a core image with all the systems preloaded, as Rob
> suggested, or by writing an initialisation script that is
> automatically run by your Lisp implementation (which would probably be
> much easier to maintain than having to create a new core image after
> every library update).  For CLISP, this would be, I think, a file
> called .clisprc.lisp in your home directory.  It might look like this
> (caution: not tested!):
>
>   (load "/home/mulk/Downloads/Systems/ASDF/asdf.lisp")
>   (push #p"/home/mulk/.clc/systems" asdf:*central-registry*)
>   (dolist (system-name '(:cl-ppcre :split-sequence :iterate))
>     (asdf:oos 'asdf:load-op system-name))
>
> This example utilises the fact that ASDF maintains a set of central
> directories that it searches when you ask it to load a system, here
> manually extended with the directory /home/mulk/.clc/systems.  Maybe
> this is what you meant by "a central installation"?  Try symlinking
> (not copying!) all your .asd files to ~/.clc/systems and putting the
> above in your .clisprc file (replacing all occurences of "/home/mulk"
> with your home directory) in order to load the ASDF systems CL-PPCRE,
> SPLIT-SEQUENCE and ITERATE on every CLISP session start.
>
> If you're using Windows, symlinking files will obviously not work.  In
> that case, you can try something like the following (caution: even
> less tested :)):
>
>   (load "/home/mulk/Downloads/Systems/ASDF/asdf.lisp")
>   (dolist (subdir (directory #"/home/mulk/.clc/systems/*"))
>     (push subdir asdf:*central-registry*))
>   (dolist (system-name '(:cl-ppcre :split-sequence :iterate))
>     (asdf:oos 'asdf:load-op system-name))
>
> And put your downloaded libraries as subdirectories into /home/
> mulk/.clc/systems/ (in this example).
>
> I'm not all that familiar with using ASDF on Windows or using .clisprc
> to load systems that you frequently need, but I hope these examples
> help a little (I also hope they're not completely wrong. :)).
>
> Mata ne,
> Matthias


I'm not (*) very knowledgeable about Common Lisp, but I'm learning. I
digged up some information about setting up initialization files for
CLISP on Windows and summed it here:

I will Hopefully it will be useful for others.

Thanks for all the help. I will try the memory image technique too.
Eli

(*) Isn't it funny that on a QWERTY keyboard 'w' is right next to 't',
making "now" instead of "not" (and vice versa) a common mistake for
fast typers :-) Moreover, the spell checkers don't check it. In the
sentence marked with (*) it could make a big difference (and did,
before I noticed and fixed it).
From: Eli Bendersky
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186592055.393757.11290@r34g2000hsd.googlegroups.com>
> I'm not (*) very knowledgeable about Common Lisp, but I'm learning. I
> digged up some information about setting up initialization files for
> CLISP on Windows and summed it here:

I forgot the link, sorry:

http://eli.thegreenplace.net/2007/08/08/setting-up-an-initialization-file-for-clisp-on-windows/
From: David Trudgett
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <f9eucq$ll4$1@news-01.bur.connect.com.au>
On Aug 9, 1:51 am, Matthias Benkard <··········@gmail.com> wrote:

 > If you're using Windows, symlinking files will obviously not work.

*Obviously*! ;-) In fact, it does work:

cygwin$ cd asdf-systems
cygwin$ ln -s cool-lib/cool-lib.asd .

windows-native-clisp> (asdf:operate 'asdf:load-op 'cool-lib)

And there you have it. Obviously, one should not always let Windows' 
lack of real symlinks get in the way of creating symlinks when you need 
them! :-)

David
From: Slobodan Blazeski
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186664468.266942.246070@b79g2000hse.googlegroups.com>
On Aug 9, 1:42 pm, David Trudgett <··········@aapt.net.au> wrote:
> On Aug 9, 1:51 am, Matthias Benkard <··········@gmail.com> wrote:
>
>  > If you're using Windows, symlinking files will obviously not work.
>
> *Obviously*! ;-) In fact, it does work:
>
> cygwin$ cd asdf-systems
> cygwin$ ln -s cool-lib/cool-lib.asd .
>
> windows-native-clisp> (asdf:operate 'asdf:load-op 'cool-lib)
>
> And there you have it. Obviously, one should not always let Windows'
> lack of real symlinks get in the way of creating symlinks when you need
> them! :-)
>
> David

Providing that you want to install Cygwin. Or you could configure your
start up file to search for the asd files in specified folder(s) like
described in http://bc.tech.coop/blog/041113.html

(defvar *lisp-dirs* "c:/usr/home/lisp/" "Root location of CL library
installs")
(load (concatenate 'string *lisp-dirs* "asdf/asdf.lisp"))

#+allegro (dolist (dir-candidate (directory (concatenate 'string *lisp-
dirs* "*")))
	    (when (file-directory-p dir-candidate)
	      (let ((asd-candidate (merge-pathnames "*.asd" (pathname-as-
directory dir-candidate))))
		(when (directory asd-candidate)
		  (push (pathname-as-directory dir-candidate) asdf:*central-
registry*)))))
#+lispworks (dolist (dir-candidate (directory (concatenate 'string
*lisp-dirs* "*")))
	      (when (lw:file-directory-p dir-candidate)
		(let ((asd-candidate (merge-pathnames "*.asd" dir-candidate)))
		  (when (directory asd-candidate)
		    (push dir-candidate asdf:*central-registry*)))))
#+clisp (dolist (dir-candidate (directory (concatenate 'string *lisp-
dirs* "*/")))
	  (let ((asd-candidate (merge-pathnames "*.asd" dir-candidate)))
	    (when (directory asd-candidate)
	      (push dir-candidate asdf:*central-registry*))))
From: Zach Beane
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <m3bqdihwus.fsf@unnamed.xach.com>
Eli Bendersky <······@gmail.com> writes:

[on saving an image]
> It certainly is an unusual approach, when compared with other
> languages and systems. I see some advantages and disadvantages - for
> example, I have to manually recreate the image each time I have a new
> module installed. Also, if for some reason the image goes wrong I have
> to re-load *everything* manually again to recreate it.
>
> Are there alternative approaches, perhaps closer to the "common"
> method of a central installation of which every invocation is aware ?

Another option is to set up your initialization file to load things
you want available. This will be, to some degree, slower than saving
an image, but it is a bit easier to manage.

Zach
From: Slobodan Blazeski
Subject: Re: How to permanently add libraries to my clisp installation?
Date: 
Message-ID: <1186664239.229306.125020@d55g2000hsg.googlegroups.com>
On Aug 8, 6:35 am, Eli Bendersky <······@gmail.com> wrote:
> Hello,
>
> My question pertains to CLISP on Windows. I'm looking for an accepted
> way to have some libraries (downloaded from the web, for instance)
> permanently available in my CL coding with CLISP. For example the ASDF
> library which isn't preinstalled with CLISP but can be easily obtained
> as a single .lisp file online. How can I make ASDF always available
> for my lisp code ? What is the best way to achieve this ?
>
> Thanks in advance
> Eli

I don't use CLisp but if my memory serves me well lispbox
http://www.gigamonkeys.com/lispbox/ comes with asdf, portable aserve
&  PCl code, so download libraries you need, place them in the folder
where PCL code & portable aserve folder reside and you'll be able to
load them via asdf.