grzegorzmazur / yacas

Computer calculations made easy
http://www.yacas.org
GNU Lesser General Public License v2.1
126 stars 24 forks source link

Where with and-list #314

Closed Isomorph70 closed 4 years ago

Isomorph70 commented 4 years ago

Wrong answer in Where with unassigned variable 'a'. The first and fourth application shows the error. In> a Where {x==1 And y==1} Out> 1==1 <<<<<<<<<<<<<<<<<< Should be 'a' In> x Where {x==1 And y==1} Out> 1 In> y Where {x==1 And y==1} Out> 1 In> x+y+a Where {x==1 And y==1} Out> (1==1)+2 In> a Where {x==1} Out> a

Isomorph70 commented 4 years ago

In> c Where (x==1 And y==1); Out> c In> var Where (x==1 And y==1); Out> x In> body Where (x==1 And y==1); Out> body In> a Where (x==1 And y==1); Out> 1==1 In> b Where (x==1 And y==1); Out> 1==1

Seem to be a problem when using variable with same names as used in the code. 10 # (_body Where var_IsAtom == _value) <-- [Local(@var);@var := @value;@body;]; 20 # (_body Where (_a And _b)) <-- [ Set(body,(@body Where @a)); `(@body Where @b); ];

When I use variable names as a,b,var, that is also used in the code, it produce an error.

Isomorph70 commented 4 years ago

Could be tested with:

Verify(({a,b,var,body} Where x==1 And y==1),{a,b,var,body})

grzegorzmazur commented 4 years ago

Hi,

Good catch! And actually you've found not only the problem, but the solution as well :)

Cheers, Grzesiek