[GiNaC-list] Syntact Ambiguity

Sheplyakov Alexei varg at theor.jinr.ru
Tue Oct 4 07:25:38 CEST 2005


On Mon, Oct 03, 2005 at 12:49:18PM -0400, Alan Bromborsky wrote:
> Consider the statements:
> 
>    lst test;
> 
>    test = x+2*y,A*z-B*pow(z,2),x+y+z;
> 
> There is a problem here due  to the  ","  in  "pow(z,2)" which cases 
> the list elements to be separated incorrectly.

This program:

#include <iostream>
#include <stdexcept>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main(int argc, char** argv)
{
	symbol x("x");
	symbol y("y");
	symbol z("z");
	symbol A("A");
	symbol B("B");

  lst test;

  test = x+2*y, A*z-B*pow(z,2), x+y+z;

	cout << test << endl;
	return 0;
}

prints

{2*y+x,A*z-z^2*B,z+y+x}

This is exactly what I expect, (the comma in `pow(z,2)' separates
function arguments, it has nothing to do with (overloaded) operator,),
so I can't see any problems here.

Could you please be more specific -- what do you expect and what
actually happens?

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20051004/a542e30d/attachment.pgp


More information about the GiNaC-list mailing list