Re: [q-lang-users] The implicit operator in Q
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-07-24 11:50:11
|
John Cowan wrote: > This makes me a bit nervous. Would it be possible to distinguish > between constants and constructors, and allow a constant in the head > (but not all constants) while still forbidding a constructor? That would be a rather arbitrary distinction between constructors of zero and nonzero arity. > The whole point of constructors is that the application of a constructor > is guaranteed to be in normal form. Given a declaration like "type BinTree = const bin X T1 T2;" you still have that the following equations are all forbidden: bin = ...; bin X = ...; bin X T1 = ...; bin X T1 T2 = ...; So, if you have an expression of the form bin X T1 T2 you can still be sure that it is a normal form. I guess that this solves your problem? OTOH, the following equation is now valid: bin X T1 T2 Y = ...; Which makes sense if you want to also be able to use an (essentially equivalent) equation like: T:Bintree Y = ...; I've already implemented it that way, and I've also updated the documentation in qdoc.texi. Seems to work nicely so far. If you want to try it out, just get yourself the latest qcrules.c from cvs and recompile. Cheers, 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 |