I'm starting with Lisp, trying to figure out how to use the Lisp package system properly when learning LTK GUI programming using SBCL 1.0.55.0.debian and Limp 0.3.4 (and if it matters Debian Wheezy), I installed ASDF using the dispatcher aptitude packages (cl-asdf and cl-common-lisp -controller packages), then I installed Quicklisp using the instructions on the Quicklisp website ( http://www.quicklisp.org/beta/index.html ) (and not from Debian repository) and then I installed LTK with (ql:quickload 'ltk) in the SBCL console.
hello-1.lisp (directly from the LTK tutorial):
(defun hello-1() (with-ltk () (let ((b (make-instance 'button :master nil :text "Press Me" :command (lambda () (format t "Hello World!~&"))))) (pack b))))
If I compile it directly in the new SBCL Lisp image, I get a message that WITH-LTK and PACK are undefined functions, and 'BUTTON is an undefined variable.
So, I found out that I need to download 'ltk first and then use in-package .I to be able to run it, I must first use (ql:quickload 'ltk) and (in-package :ltk) in the SBCL console . However, I am still an error message that 'BUTTON is an undefined variable.
* (ql:quickload 'ltk) To load "ltk": Load 1 ASDF system: ltk ; Loading "ltk" (LTK) * (in-package :ltk)
Then, since this did not work out the way I wanted, I also tried to define my own package definitions according to the answers of another question ( Problems with ltk (general lisp) , Xach blog post "Creating a small Lisp project with a quick project and Quicklisp" http://xach.livejournal.com/278047.html?thread=674335 and the ASDF manual ( http://common-lisp.net/project/asdf/asdf/The-defsystem-form.html ) using quickproject:make-project , but to no quickproject:make-project currently have the following files:
package.lisp ( (ql:quickload 'ltk) if I first (ql:quickload 'ltk) SBCL REPL):
(defpackage :hello-world-ltk-system (:use :cl :asdf :ltk))
hello-world-ltk.asd (compiles cleanly after I compiled package.lisp first):
(in-package :hello-world-ltk-system) (asdf:defsystem :hello-world-ltk :serial t :description "Describe hello-world-ltk here" :author "Your Name < your.name@example.com >" :license "Specify license here" :depends-on (:cl :asdf :ltk) :components ((:file "package") (:file "hello-world-ltk")))
hello-world-ltk.lisp (I get a compilation error The name "HELLO-WORLD-LTK" does not designate any package ).
(require 'hello-world-ltk) (in-package :hello-world-ltk) (defun hello-world-1 () (with-ltk () (let ((b (make-instance 'button :master nil :text "Press me!" :command (lambda () (format t "Hello world!~&"))))) (pack b))))
When I try to compile this hello-world-ltk.lisp after successfully compiling package.lisp and hello-world-ltk.asd (which are all in the same directory), I get the following error:
; compiling (IN-PACKAGE :HELLO-WORLD-LTK) debugger invoked on a SB-KERNEL:SIMPLE-PACKAGE-ERROR in thread #<THREAD "initial thread" RUNNING {10029A0FA3}>: The name "HELLO-WORLD-LTK" does not designate any package. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. (SB-INT:%FIND-PACKAGE-OR-LOSE "HELLO-WORLD-LTK") 0] (load "/home/user/code/lisp/hello-world-ltk/hello-world-ltk") debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread" RUNNING {10029A0FA3}>: attempt to load an empty FASL file: "/home/user/code/lisp/hello-world-ltk/hello-world-ltk.fasl" Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Reduce debugger level (to debug level 1). 1: Exit debugger, returning to top level. (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /home/user/code/lisp/hello-world-ltk/hello-world-ltk.fasl" {1005291233}> NIL #<unavailable argument>) 0[2]
So, I am completely lost here with all the different ways to define packages: ASDF, Quicklisp, package.lisp, quickproject , asdf:defsystem , require and ql:quickload ... quickproject:make-project looks promising, but I really don't know what not so with my source files yet. I am looking for a solution that should handle all compilation and package downloads, preferably in one command for the whole project, and this should also expand for large projects.
Thanks for any help :)