1

I download a lisp source CC3.lisp started with

(if (not (find-package "CC3"))
    (defpackage "CC3"))
(in-package "CC3")

(export '(true false bogus rd sunday monday tuesday wednesday)) 

and others.

I would like to write a test.lisp to test its calculation.

One may say ASDF but being a newbie and just want to use one lisp file, that seems an over-kill, not to mention I found the relationship with load, package, system, modules, ASDF, quick-lisp overwhelming.

Any hint how to write a few script to get me started. I suspect it would involve

  • load files
  • (in-package ...)

etc.

However, if ASDF/Quick-Lisp is only way out, please tell me as well.

Thanks.

=== I manage to hack a asdf workflow like this under CCL (mac os x):

Get the source file into asdf directory:

(require 'asdf)

;;; but no central-registry

(setf asdf:*central-registry*
   ;; Default directories, usually just the ``current directory''
  '(*default-pathname-defaults*
   ;; Additional places where ASDF can find
   ;; system definition files
   #p"/Users/.../CC3-asdf/"
   #p"/usr/share/common-lisp/systems/"))

Then seems need to be run only once

I need this (but do not know how this related to asdf even using .asd; just use it as a lisp file and execute all under CCL editor).

astro.asd

(defpackage #:astro-asd
  (:use :cl :asdf))

(in-package :astro-asd)

(defsystem astro
  :name "astro"
  :serial t ;; the dependencies are linear.
  :components ((:file "cc3.0.cl-loadpackage")
               (:file "cc3.0.cl")
               (:file "cc3.0.cl-testing")))

After executing the above file as lisp under CCL editor (execute all) then

Execute this command under CCL Listener

(asdf:operate 'asdf:load-op 'astro)

After this I can execute a file that use the package like this (after seeing what it likes in How can I specify the package name when launching a Lisp program from the command line?) but really not sure how this all worked.

cc3-testing.lisp:

cc3::ujjain
(cc3::hindu-sine-table 12)
(format T "sunset ~a~%" (CC3::sunset (CC3::fixed-from-gregorian (CC3::gregorian-date 1996 CC3::february 25)) CC3::jerusalem))
;;; (use-package "CC3") not working ... conflict ... 
(in-package "CC3") ;;; work
(format T "~a~%" (sunset (fixed-from-gregorian (gregorian-date 1996 february 25)) jerusalem))

The directory now has

--astro-asdf
  --- astro-load-central-registory.lisp
  --- astro.asd
  --- cc3-... other lisp.
  --- cc3-testing.lisp

I have to load astro.ad every time and then execute that asdf command. Then I use the cc3-testing.lisp to test the cc3 system.

Is that sound right?

Community
  • 1
  • 1
Dennis Ng
  • 79
  • 6

1 Answers1

1

This looks like old pre-ASDF2 advice.

1- for portability to CLISP, use (require "asdf"), not (require 'asdf).

2- no need to conditionalize your defpackage.

3- no need to defpackage and in-package in your .asd file.

4- call your file package.lisp, cc3.lisp, test.lisp, and your components "package", "cc3", "test".

5- move test to its own (defsystem "cc3/test" :depends-on ("cc3") :components (:file "test"))

Faré
  • 952
  • 5
  • 4
  • 6- to load, put everything under a subdirectory of ~/common-lisp/ and use (asdf:load-system "cc3") – Faré Apr 19 '15 at 18:43
  • 7- I'm assuming your implementation provides ASDF 3.1.2 or later. – Faré Apr 19 '15 at 18:43
  • Thanks. Try this morning but not exactly working ... would try again tonight after work. Not sure about the cc3/test and also not sure depends-on :component syntax. Cannot find cc3. Seems not the same as the asdf3 manual. https://common-lisp.net/project/asdf/asdf.html#Loading-a-system – Dennis Ng Apr 22 '15 at 00:27