apply_nouns



> what you really want is not a way of substituting verbs for nouns,
> but essentially to do ev(...,nouns) except not recursively.

Exactly.

> Have you looked into using pattern-matching instead of functions?

I have, and I actually use pattern-matching for some purposes, but it won't
work here. (It could be made to work for specific problems, I presume, but
not as a generic solution.)

> For that matter, if you explained your global problem to us

Actually, the example I gave you pretty clearly demonstrates the problem
without any tensor-specific details. But, since you asked...

This thing came up as I was trying to invent a way to represent a
Kaluza-Klein metric in Maxima. Without going into _too much_ detail, at one
point I have tensors represented by functions that should yield 0 or an
unevaluated derivative depending on whether they're differentiated with
respect to the first four or the fifth coordinate. So G5([I,J],[],K)
(itensor notation) should remain unevaluated, but G5([I,J],[],5) should
evaluate to 0. Or, as a further example, if ASSUME(I<=4) and ASSUME(I<=4)
are applied, G5([I,J],[]) should evaluate to G4([I,J],[]), but otherwise it
should remain G5([I,J],[]).

I can express these nicely using tensors defined with functions and I've
already fixed a number of spots in the itensor code so that the code now
correctly handles (e.g., contracts, differentiates) tensors regardless
whether their components were defined using COMPONENTS() or through
functions. The problem is that since my function definitions return the
quoted noun form of the function in some cases, EV %,NOUNS leads to the
problem I described earlier.

> You seem to be a Lisp programmer, so perhaps the right solution
> is to write your own simplifying routines?

I think you have a point there. So if I understand you correctly, what
you're suggesting is that instead of writing a top-level function (like my
attempt at APPLY_NOUNS), I should write a simplification routine that can be
used as a parameter to EV()?


Viktor