Re: [Boost-users] equation (really expression) idea (follow-up)
From: "Stephen Gross"
Ok, at least one person said they were interested in seeing my idea for an equation toolkit, so here goes... The files a few hundred lines, so hopefully that's ok for this group. If I've exceed some message size, I'm sorry in advance...
This is a decent start, but I have several problems with it. 1. Types are not template-ized. I don't want everything to be a double. 2. Perhaps variables should be first-class objects, not just placeholders in BLL. 3. (Style not substance) Many of the type and function names aren't very clear. Examples: go() and MapType; I'm thinking the client syntax should be something more like this: expression expr; variable<double> x; variable<int> y; expr = x + y; double v = expr; // would throw because x and y are unassigned x = 10; y = 20; v = expr; // assigns 30 to v It would be cool to then be able to define some sort of 'evaluate' function so that you could write: v = expr.evaluate(10, 20); // v <- 30 Perhaps this is where the BLL comes in, because you'd first have to map the positional arguments to the variables in the expression. Maybe you could also extend this to handle currying. - James
participants (1)
-
james.jonesīŧ firstinvestors.com