How to permanently add libraries to my clisp installation? - lisp

This is a discussion on How to permanently add libraries to my clisp installation? - lisp ; 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 ...

+ Reply to Thread
Results 1 to 10 of 10

How to permanently add libraries to my clisp installation?

  1. Default How to permanently add libraries to my clisp installation?

    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


  2. Default Re: How to permanently add libraries to my clisp installation?

    Eli Bendersky <eliben@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@rpw3.org>
    627 26th Avenue <URL:http://rpw3.org/>
    San Mateo, CA 94403 (650)572-2607


  3. Default Re: How to permanently add libraries to my clisp installation?

    On Aug 8, 10:54 am, r...@rpw3.org (Rob Warnock) wrote:
    > Eli Bendersky <eli...@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



  4. Default Re: How to permanently add libraries to my clisp installation?

    Eli Bendersky <eliben@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

  5. Default Re: How to permanently add libraries to my clisp installation?

    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))
    (asdfos '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))
    (asdfos '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


  6. Default Re: How to permanently add libraries to my clisp installation?

    On Aug 8, 5:51 pm, Matthias Benkard <mulkiat...@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))
    > (asdfos '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))
    > (asdfos '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).


  7. Default Re: How to permanently add libraries to my clisp installation?

    > 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...sp-on-windows/


  8. Default Re: How to permanently add libraries to my clisp installation?

    On Aug 9, 1:51 am, Matthias Benkard <mulkiat...@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> (asdfperate '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

  9. Default Re: How to permanently add libraries to my clisp installation?

    On Aug 8, 6:35 am, Eli Bendersky <eli...@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.


  10. Default Re: How to permanently add libraries to my clisp installation?

    On Aug 9, 1:42 pm, David Trudgett <dktrudg...@aapt.net.au> wrote:
    > On Aug 9, 1:51 am, Matthias Benkard <mulkiat...@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> (asdfperate '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*))))


+ Reply to Thread

Similar Threads

  1. Installing CLisp
    By Application Development in forum lisp
    Replies: 3
    Last Post: 11-21-2007, 12:36 AM
  2. fastcgi and clisp
    By Application Development in forum lisp
    Replies: 1
    Last Post: 11-13-2007, 11:11 PM
  3. how modify $: permanently?
    By Application Development in forum RUBY
    Replies: 2
    Last Post: 10-27-2007, 05:37 PM
  4. Replies: 12
    Last Post: 06-29-2007, 04:25 PM
  5. Replies: 1
    Last Post: 06-29-2007, 08:41 AM