Hi Rob,
> It is possible to define a ternary infix operator? For example, suppose
> the operator is called f, and takes three arguments
> public f P X Y;
>
> I'd like to write
> X (f 13) Y
> rather than
> f 13 X Y
No, sorry, this isn't possible right now. Since operators are detected
at the lexical level already, I don't even see how this could be
implemented in an LALR(1) parser.
I think there are a few languages which essentially open up the language
syntax to allow the programmer to do this kind of thing (define new
mixfix operators etc.), but I don't think that this would work well in
modern FPL syntax with curried function applications.
> If it can't be done, then I don't consider it important enough (or even
> necessarily desirable) to implement. I just wondered whether there might
> be some kind of Q trick I'd not thought of.
Well, you could define an ordinary infix operator, but then you'd have
to use something like X f 13 Y which would actually be parsed as X f (13
Y) so this is probably not what you want. It would be a rather dirty
trick anyway, and wouldn't work in all cases (e.g., X f succ 12 ==> X f 13).
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
|