Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* * This file: * http://anggtwu.net/MAXIMA/luatree3.mac.html * http://anggtwu.net/MAXIMA/luatree3.mac * (find-angg "MAXIMA/luatree3.mac") * Author: Eduardo Ochs <eduardoochs@gmail.com> * * (defun e () (interactive) (find-angg "MAXIMA/luatree3.mac")) * (find-es "maxima" "mtree") * (find-es "maxima" "buildq-lambda") * (find-es "lisp" "format-recipes") */ luatree0_number (o) := string(o); luatree0_string (o) := format("~s", o); luatree0_symbol (o) := format("~s", o); /* for $FOO and FOO */ luatree0_symbol (o) := string(o); /* for foo and ?foo */ luatree0_apatom (o) := append([ luatree0(op(o))], map(luatree0, args(o))); luatree0_apother(o) := append(["ap", luatree0(op(o))], map(luatree0, args(o))); luatree0_subvarp(o) := append(["[_]", luatree0(op(o))], map(luatree0, args(o))); luatree0(o) := if stringp(o) then luatree0_string (o) elseif symbolp(o) then luatree0_symbol (o) elseif numberp(o) then luatree0_symbol (o) elseif subvarp(o) then luatree0_subvarp(o) elseif atom(op(o)) then luatree0_apatom(o) else luatree0_apother(o); /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("luatree3.mac"); luatree0_string("foo bar"); luatree0_string("foo \"bar"); luatree0_string("foo \\bar"); luatree0_symbol(foo); luatree0_symbol(?foo); luatree0(2); luatree0("2"); luatree0([2, "2"]); luatree0(f(a)); luatree0(f(a)(b)); luatree0(a[b]); luatree0(a[b][c]); luatree0(lambda([], 2+3)); block([], simp:false, luatree0(lambda([], 2+3))); foo(o) ::= block([], simp:false, luatree0(lambda([], 2+3))); "2"; "\"2\""; */ /* * Local Variables: * coding: utf-8-unix * End: */