Re: if-expression and variables
Ralf Hemmecke <[email protected]> Wed, 04 May 2011 20:02:18 +0200
| Newsgroups | gmane.comp.mathematics.axiom.general |
|---|---|
| Message-ID | <[email protected]> |
>> 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. As I said, it's no problem to implement that in Axiom. Actually, InputForm is basically such a domain. > 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. Although possible, that is a mindset that belongs to traditional (typeless) CAS. I would rather ask the questioner to state the actual problem instead of already giving a direction, i.e. using expression trees. > 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. Well, of course, that's possible. In fact, expression trees is something that almost all computer algebra systems rely upon. But Axiom is different. Take for example 1+1. What is this evaluated? Three out of infinitely many results. 1) 2 2) 0 3) 1+1 In Axiom (at least in SPAD) there would only be one possible result, since the compiler checks types. If it is clear what 1 and + means, it's also deterministic what the result is. Ralf