| Author |
Comment/Response |
Daniele Lupo
|
12/19/06 5:32pm
Hi to all.
I've created an object that has this form:
{a,b,{{a11,a12},{a21,a22}},{b1,b2,b3},c,d}
As you can see, this is more complicated than a simple list.
Now I want to create a function that works only with this element.
If i put
f[x_] := something
f is evaluated for everithing that's x, and
f[x_List] := something
works for every list.
I can write something that
f[{x_,y_,{{a_,b_},{c_,d_}},e_,f_}] := something
but it's not useful when f calls other functions that require the same augment, like
f[x_]:=g[x]+h[x].
This is more simple than write entire pattern.
What do I must write to be sure that this function is evaluated only if x has pattern of my element? Because if f is evaluated with something that has not that pattern, I have a lot of errors that annoy me...
Thanks for answers
Daniele
URL: , |
|