From: Albert G. <Dr....@t-...> - 2008-08-08 09:30:05
|
Hi David, David Baird wrote: > 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 There's not type for symbols in either Pure or Q, and in Q the type of integers is named Int (section 8.2 of the manual), int and bigint in Pure. To check for free variable symbols, there's the isvar predicate, described in Section 10.8 of the manual (varp in Pure, see primitives.pure). So something like this should do the job in Pure: a*b::int = b*a if varp a; x*a*b::int = x*b*a if varp a; (In addition, you'll probably need some associativity rules to make this work in the general case.) HTH, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |