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?