On 5/31/2010 11:35 AM, Eric Niebler wrote:
On 5/30/2010 10:50 PM, alfC wrote: <snip>
Sure, glad you are interested. Let me know if you need more details, what I am doing now is an experimental code to interface GSL routines from C++ that uses lambda expression. Experimental in the sense that I want to see how far I can get with Phoenix in terms of building a natural (mathematical) language interface to numerical routines. In this experimental code I am trying to make the functions smart enough to recognize *simple* patterns in the expression. In this example, it recognizes the singularity (at 3.) in the integral
integral( f( _1 )/(_1 - 3.) , interval(2., 4.));
other simple expressions are
solve( f(_1) == 2.);
just to give you an idea. I am not sure if am repeating someone else's work but when I see expression templates in C++ I see numerical and symbolic mathematics converge into the perfect language to do scientific computing. Of course the patterns do not need to be necessarily *simple* in the future, once we master Phoenix we can go beyond to write transformation rules for expression, in order to do that I must gain complete access to the internal subexpressions and subexpression types.
In that case, I think your best bet is to build your own DSEL using Proto. Proto will let you define placeholders and will build expressions for you. It will *also* give you the tools to access, analyze and transform subexpressions in the ways you describe. In essence, you'll need to implement your own mini-Phoenix. That's the bad news.
The good news is: in the (near!) future, Phoenix will be built on top of Proto so that you'll be able to use Proto to access, analyze and transform Phoenix expressions.
Incidentally, your message is very timely. Joel and I have just been discussing off-list the possibilities opened up by giving users access to Phoenix expressions at this level. It's really very exciting.
Indeed very timely. See also: http://tinyurl.com/37mguzo "phoenix domain language (to write mathematical formulas)" (Cc'ing the author) This is not the first time Phoenix has been used this way. Yet one of the reasons why I insist on a simple extension interface. I think we're on the right track, Eric. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon