Subject: I really don't understand rules and patterns
From: Daniel Lakeland
Date: Tue, 02 Apr 2013 13:25:54 -0700
What is going on here? I want to find sums involving x,y, or z, and an
index variable, i, j, k and a symbol dq and do something to them. I have
rules like:
matchdeclare(var,lambda([x],member(x,'[x,y,z])),
indx,lambda([x],member(x,'[i,j,k])),
int,integerp);
defrule(recenteridxsum,var+int*dq+indx*dq,[var+indx*dq,int]);
(%i179) recenteridxsum(x+dq*i+dq);
(%o179) false
This would seem to be wrong. I don't know why it does this though.
(%i180) recenteridxsum(x+dq*i);
(%o180) [x + dq i, 0]
this is correct, and is the only case that seems to work. I am confused.