|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* This file:
* http://angg.twu.net/luatree/luatree.mac.html
* http://angg.twu.net/luatree/luatree.mac
* (find-angg "luatree/luatree.mac")
* See also:
* https://github.com/edrx/luatree
* https://github.com/edrx/luatree/#introduction
* http://angg.twu.net/eev-maxima.html#luatree
* http://angg.twu.net/e/maxima.e.html#luatree
* http://angg.twu.net/e/maxima.e.html#luatree-explanation
* (find-es "maxima" "luatree")
* (find-es "maxima" "luatree-explanation")
* Author: Eduardo Ochs <eduardoochs@gmail.com>
* License: Public Domain.
*
* (defun m () (interactive) (find-angg "luatree/luatree.mac"))
* (defun li () (interactive) (find-angg "luatree/luatree.lisp"))
* (defun lu () (interactive) (find-angg "luatree/luatree.lua"))
*
* «.luatree_rd» (to "luatree_rd")
*/
luatreedir : pathname_directory(load_pathname);
load (concat(luatreedir, "luatree.lisp"));
luatree1 : lambda([o], concat( "\"", o, "\""));
luatreeop : lambda([o], concat("[0]=\"", o, "\""));
luatreearg : lambda([o], concat(", ", luatree1d(o)));
luatreeargs : lambda([L], apply('concat, map(luatreearg, L)));
luatreeopargs : lambda([o], concat("{", luatreeop(op(o)), luatreeargs(args(o)), "}"));
luatree1d : lambda([o], if atom(o) then luatree1(o) else luatreeopargs(o));
luatree : lambda([o], print(luatree_lua(luatree1d(o))), ""); /* calls lua */
/*
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/luatree/
mkdir /tmp/luatree/
cd /tmp/luatree/
git clone https://github.com/edrx/luatree .
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load ("/tmp/luatree/luatree.mac");
luatreedir;
MV2 : 'integrate(fp(g(x))*gp(x), x, a, b) = 'integrate(fp(u), u, g(a), g(b));
luatree (MV2);
luatree1d(luatree1d);
luatree (luatree1d);
luatree (luatree);
*/
/* «luatree_rd» (to ".luatree_rd")
* A variant by Robert Dodier (slightly uglified). See:
* https://sourceforge.net/p/maxima/mailman/message/37690570/
* https://sourceforge.net/p/maxima/mailman/message/37690821/
* (find-maximamsg "37690570 202208 06" "RDodier: lua_table_from(e) :=")
* (find-maximamsg "37690821 202208 07" "RDodier: public domain")
*/
luatree_rd_0(__e__) :=
if atom(__e__)
then string(__e__)
else funmake(lua_table, cons([0]=op(__e__), map(luatree_rd_0, args(__e__))));
luatree_rd_1(__e__) :=
block([simp:false], string(subst(lua_table=set, luatree_rd_0(__e__()))));
luatree_rd(__e__) := (print(luatree_lua(luatree_rd_1(__e__))), "");
/*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load ("~/luatree/luatree.mac");
luatree_rd_0 (lambda([], 2*3 + 4/5 + 6));
luatree_rd_1 (lambda([], 2*3 + 4/5 + 6));
luatree_rd (lambda([], 2*3 + 4/5 + 6));
luatree_rd (lambda([], [format, ?format]));
*/
/*
* Local Variables:
* mode: c
* modes: (c-mode maxima-mode)
* End:
*/