How to create package / system files?

Discussion of Common Lisp

How to create package / system files?

Postby Newbie » Sun Jul 15, 2012 1:37 pm


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

Code: Select all
(defpackage :helloworld
  (:use :common-lisp)
  (:export :helloworld ))

and made a hw.asd file
Code: Select all
(defsystem :helloworld
  :name "Hello World"
  :version "0.1"
  :components ((:file "hw")))

Code: Select all
(require 'helloworld)

leads only to
Code: Select all
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.
Posts: 2
Joined: Sun Jul 15, 2012 1:03 pm

Re: How to create package / system files?

Postby nuntius » Mon Jul 16, 2012 1:17 pm

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.
User avatar
Posts: 532
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: How to create package / system files?

Postby edgar-rft » Mon Jul 16, 2012 8:12 pm

The LISPBUILDER-SDL Windows SBCL installation tutorial contains a description how to setup ASDF with SBCL on Windows.
Posts: 224
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: How to create package / system files?

Postby Newbie » Tue Jul 17, 2012 12:20 pm

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

Code: Select all

and after loading the package definition by
Code: Select all
(ql:quickload 'hw)

Code: Select all
(require 'hw)

loads the package.

I hope that helps other with similiar issues in future.
Posts: 2
Joined: Sun Jul 15, 2012 1:03 pm

Re: How to create package / system files?

Postby virex » Tue Jul 31, 2012 5:19 am

IIRC, you can use the variable
Code: Select all

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.
Posts: 17
Joined: Fri Oct 28, 2011 3:41 pm

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 4 guests