How to create package / system files?

Discussion of Common Lisp
Post Reply
Newbie
Posts: 2
Joined: Sun Jul 15, 2012 1:03 pm

How to create package / system files?

Post by Newbie » Sun Jul 15, 2012 1:37 pm

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:

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")))
However

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.

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: How to create package / system files?

Post by 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.

edgar-rft
Posts: 226
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: How to create package / system files?

Post by 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.

Newbie
Posts: 2
Joined: Sun Jul 15, 2012 1:03 pm

Re: How to create package / system files?

Post by 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

C:/home/SBCL/site-systems/hw.asd
and after loading the package definition by

Code: Select all

(ql:quickload 'hw)
then

Code: Select all

(require 'hw)
loads the package.

I hope that helps other with similiar issues in future.

virex
Posts: 17
Joined: Fri Oct 28, 2011 3:41 pm

Re: How to create package / system files?

Post by virex » Tue Jul 31, 2012 5:19 am

IIRC, you can use the variable

Code: Select all

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.

Post Reply