This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

How to create package / system files?

5 posts · 4664 views

Hello,

I am fairly new to Lisp. Or better speaking, I had a short love affair with Lisp at a time I can hardly remember. After a couple of years of unhappy marriages with other languages, I am looking to file finally for divorce and turning back to see what my old love is doing nowadays.

I succesfully installed SBCL on a Windows machine (no flaming please!) and got Emacs and slime running. Just for trying out in could load cl-mysql and ltk packages with quicklisp and got some thing running already.

I to organize my code in modules, so the (defpackage ..) comes handy, but I want to organize my code in several files on the disk as well.

I produced some code

hw.lisp:
(defpackage :helloworld
  (:use :common-lisp)
  (:export :helloworld ))
...
and made a hw.asd file
(defsystem :helloworld
  :name "Hello World"
  :version "0.1"
  :components ((:file "hw")))
However
(require 'helloworld)
leads only to
Don't know how to REQUIRE HELLOWORLD.
[Condition of type SB-INT:EXTENSION-FAILURE]
I put the files into my C:\home\SBCL\site-systems directory, but this was only a guess. Maybe they weren't read in for that reason.

Re: How to create package / system files?

I forget where ASDF looks for things on Windows these days. Here's the manual.

You may need an explicit "(require :asdf)" to get ASDF loaded first. On SBCL, ASDF auto-hooks into REQUIRE; but "(asdf:load-system :helloworld)" is the fundamental call.

Re: How to create package / system files?

Thanks for the replies.

I used quicklisp so far for loading the ltk and my-sql packages, so I investigated whether quicklisp was some kind of help. After googling for quicklisp functionality, I found that you can to edit the quicklisp/local-projects/system-index.txt by adding
C:/home/SBCL/site-systems/hw.asd
and after loading the package definition by
(ql:quickload 'hw)
then
(require 'hw)
loads the package.

I hope that helps other with similiar issues in future.

Re: How to create package / system files?

IIRC, you can use the variable
asdf::*default-source-registry*
to see in what directory ASDF starts looking. You can also specify this yourself, using the interface edgar-rft linked to, but that's quite a bit of a clusterfoo.