|
From: Eduardo O. <edu...@gm...> - 2025-12-13 04:16:06
|
Hi list, this page https://anggtwu.net/maxima-edrxbox.html describes a library that lets us write `dim-*' functions like this, --snip--snip-- (setf (get '$antideriv 'dimension) 'dim-antideriv) (defun dim-antideriv-core (a b c) (let* ((a-box (edrxbox-from-form a)) (b-box (edrxbox-from-form b)) (c-box (edrxbox-from-form c)) (a-height (getf a-box :height)) (b-height (getf b-box :height)) (c-height (getf c-box :height)) (a-depth (getf a-box :depth)) (b-depth (getf b-box :depth)) (c-depth (getf c-box :depth)) (abc-height (max a-height (+ b-height b-depth 1))) (abc-depth (max a-depth (+ c-height c-depth))) (b-y (- abc-height b-height)) (c-y (- c-depth abc-depth)) (vbar-x (getf a-box :width)) (bc-x (+ vbar-x 1)) (vbar-box (list :width 1 :height abc-height :depth abc-depth :result `((d-vbar ,abc-height ,abc-depth))))) (edrxboxvars-push-x-y-edrxbox 0 0 a-box) (edrxboxvars-push-x-y-edrxbox vbar-x 0 vbar-box) (edrxboxvars-push-x-y-edrxbox bc-x b-y b-box) (edrxboxvars-push-x-y-edrxbox bc-x c-y c-box) (edrxboxvars-push-x-y-end))) (defun dim-antideriv (form result) (let* ((args (rest form)) (a (first args)) (b (second args)) (c (third args))) (if (not (= (length args) 3)) (dimension-function form result) (run-in-edrxbox-dim (dim-antideriv-core a b c))))) --snip--snip-- I find that style much easier to understand and debug that the one here, https://sourceforge.net/p/maxima/bugs/4639/ and much, much, MUCH easier to understand and debug than the style of the functions in displa.lisp. The page has lots of examples and screenshots. All feedback very welcome! Cheers =), Eduardo Ochs https://anggtwu.net/maxima-edrxbox.html https://anggtwu.net/eev-maxima.html |