On 05/03/2011 11:01 AM, Ralf Hemmecke wrote:
But the question is not intrinsically a "programing construct".
What does that mean?
More or less I mean a tree structure where the nodes have evaluation
contents; say Boolean evaluations or calculations. Then nodes may have
left/right (true/false) subbranches or terminate. In the case of
"case" the subbranches could be most anything. When the tree
terminates, reaches an end node, then return the terminating
evaluation/value (for debuging the option of returning the path might be
nice). If a mid-level evaluation doesn't match a subsequent branch then
return failure; of course the lack of a subbranch would be taken as
matching anything.
This isn't what I meant by "symbolic logic" but is equivalent and seems
perfectly clear without any evocation of "horn clauses" and such.
With some (bulky) symbolic logic constructs one can express it in a
mathematical sense. That is: set membership and "exclusive or".
You want to rewrite the if-statement into set membership and exclusive
or?
Yes I did; but upon reflection I am reluctant to go there.
To give a few hints. As Bill already said, Axiom is more an algebraic
system rather than a symbolic one. Of course, since Axiom has a proper
programming language underneath, one can do everything, but the
question is, how much is already implemented.
The first questions, when one programs with Axiom usually are:
What is my "domain of computation"?
(That is basically like with universal algebra. What is the carrier
set and what are the operations?)
How are the elements of the carrier set represented in terms of
already existing (library) types?
Yes, I think it boils down to second-order logic; in this case a
category of unevaluated expressions. As above; stored in the tree and
then brought front and center and evaluated in the tree accessing
environment.
Going back to the original question. It seems the questioner expects to
fabricate a template and later to create instances of it with varying
variables. I would think that keeping the old (hopefully private)
variables and then assigning incoming variables to the private variables
might eliminate having multiple copies laying around and perhaps the
need of a template at all.
Probably doesn't cover all cases though.
Sorry if I have taken the discussion drifting; I merely wanted to point
out the if/else can be a static data structure rather than in-line code.
Ray
_______________________________________________
Axiom-math mailing list
Axiom-math@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-math