(defvar *packages* nil)

(defun load-package (filename)
  (let* ((path  (concatenate 'string filename ".pkg"))
	 (forms (load path)))
   (setf *packages* (append-to-list
		    (cons filename forms)
		    (remove-if (lambda (x)
				(string= (car x) filename))
		     *packages*)))))

(defun save-package (filename lst)
  (with-sd-card (str filename 2)
   (dolist (f lst)
      (symbol-def f str))))

(defun unload-package (package)
 (dolist (sym (cdr (assoc package *packages*)))
  (makunbound sym)))

(defun add-to-package (filename list)
   (with-sd-card (str filename 1)
     (dolist (f lst)
         (symdef str))))
