| Author |
Comment/Response |
Afshin
|
02/27/09 00:07am
Pattern matching and passing it in a function, this is my question. Let say i define this variable:
myVar = tag1[tag2[a,b,c,d],tag3[h,y,k]]
Note that tag1, 2 and 3 are simply containers and not functions. For example elements[a,b,c,d] means my element list which contains {a,b,c,d}.
Making a function that takes in myVar, this is what i need:
myFunc[tag1[tag2[x_], tag3[y_]]]:= {x,y}
So in a sense i am extracting the items from my tags. Can anyone tell me why this pattern matching doesn't work when i pass myVar to my function:
My main concern is pattern matching, however this is a simple example. I would appreciate it if you let me know how one would proceed with this.
URL: a.esmaeili@ucalgary.ca, |
|