[pure-lang-users] Swapping Symbols and Integers
Status: Beta
Brought to you by:
agraef
From: David B. <dh...@gm...> - 2008-08-08 08:04:28
|
Hi, I'm new to Q/Pure, and I've searched the archives a little and the "Q in a Nutshell" doc a lot, but maybe I missed something. I have been just using Q up until now (because I only just found out about Pure). I would like rewrite an expression like: 4 * a * 3 to this: 12 * a So, I thought maybe I could create a rule like this: A:Symbol * B:Integer = B * A; // and maybe some more rules for associativity/commutivity but, like I guessed, I get an undeclared type error for Symbol and Integer (I think the type guards have to be algebraic types, not simple expressions). Is there a way to achieve this in Q or Pure? Thanks, -David |