How to write a function which may return noun form of itself in Maxima language
Subject: How to write a function which may return noun form of itself in Maxima language
From: Robert Dodier
Date: Sat, 6 Aug 2011 16:15:57 -0600
On 8/6/11, ???? <yasuaki.honda at gmail.com> wrote:
> Is there a suggested way to write a function in Maxima language which
> may return its noun form if it cannot process the arguments?
One way to handle it is to create a simplification rule for
each case. Then any arguments aside from those cases
are just left unmodified.
e.g.
matchdeclare (xx, numberp);
tellsimp (foo (xx), xx^2);
foo (123);
=> 15129
foo (x + y);
=> foo(y + x)
/* and here we make up another case that we can handle ... */
matchdeclare (ll, listp);
tellsimp (foo (ll), map (foo, ll));
foo ([1, 2, %pi, x]);
=> [1, 4, foo(%pi), foo(x)]
Hope this helps,
Robert Dodier