[q-lang-users] newbie question: Efficiency & other stuff
Brought to you by:
agraef
From: Arnoldo J. M. M. <ar...@da...> - 2005-12-27 02:24:12
|
Hello All, I have this piece of code: dmatch(E1,E2) = (#expand(E1) + #expand(E2)) - (2 * dmatchAux(expand (E1),expand(E2))); I have executed some stats commands after executing this rule, with and without the "(#expand(E1) + #expand(E2))" and it seems that q is calculating expand(E1) and expand(E2) 2 times (1). 1) Is this true? 2) if that is so, is there a way of implementing a "let" so I can compute only once the results of expand(_)? Of course I could create an elaborate chain of rules and allow this, but is there a way that doesn't involve creating several rules? Thank you! -------------------------- (1) (expand(...) is a deterministic rule, it will always return the same result for the same input) |