From: Eduardo O. <edu...@gm...> - 2024-10-29 05:27:23
|
Hi all, I found an ugly solution... Here's a complete version, http://anggtwu.net/MAXIMA/when-maxima.lisp.html http://anggtwu.net/MAXIMA/when-maxima.lisp and here is its core: --snip--snip-- (defpackage :otherpackage (:use :common-lisp)) (in-package :otherpackage) (defun foo (o) (+ 2 o)) ;; Maxima functions: ;; (eval-when (:compile-toplevel :load-toplevel :execute) ;/ #if (find-package :maxima) (when (find-package :maxima) ;| (in-package :maxima))) ;| (in-package :maxima) (eval-when (:compile-toplevel :load-toplevel :execute) ;| (when (find-package :maxima) ;| (defun $foo (o) (otherpackage::foo o)) )) ;\ #endif --snip--snip-- Cheers, Eduardo On Mon, 28 Oct 2024 at 21:45, Eduardo Ochs <edu...@gm...> wrote: > Hi all, > > in another thread I was discussing LispTree, that at this moment has > three files - two ".lisp" files and one ".mac" file. Link: > > http://anggtwu.net/lisptree.html > > The functions in the file "lisptree.lisp" can be tested in SBCL > without loading Maxima, but the file "lisptree-middle.lisp" needs > Maxima. > > I think that debugging the parts in Lisp can become easier if I merge > the two Lisp files into a single one, with a structure like this, > > (defpackage :lisptree (:use :common-lisp)) > (in-package :lisptree) > ;; ... > #+maxima > (progn > (in-package :maxima) > ;; ... > ) > > that only runs the second part if we are "inside Maxima"... but as far > as I know Maxima doesn't define a "feature", so the "#+maxima" would > have to replaced by something else that checks if > > (find-package :maxima) > > is non-nil instead of checking if some "featurep" is non-nil... > > Anyone knows a _good way_ to do that? I tried a bit with eval-when, > but I couldn't find a way to make the (in-package :maxima) be run in > compile-time as a top-level form - and because of that the `defun's in > the second part were running in "(in-package :lisptree)" instead of in > "(in-package :maxima)"... > > Thanks in advance! > Eduardo... > > |