Marco Maggi wrote:
do you want to support unary operators, too?
Hi Marco!
Well, I messed around with it some more today and now this works:
(infix '( a + sin(b) + cos(c) + tan(d + e) ))
(+ (+ (+ a (sin b)) (cos c)) (tan (+ d e)))
It's a sly trick, but I'm treating the trig functions as unary operators
here.
Of course, you don't want to have to identify every symbol that
represents some function that you'd like to use in 'infix'. On the other
hand, if you say "treat all non-operator symbols as functions" then how
do you specify which items are variables? Maybe one way is to use a
notation like 'quote'. So here:
('x + 'y + abc('a + 'b))
The quoted symbols are treated as operands. 'abc' a non-operator symbol
so it defaults to being treated as a unary operator.
It might also be nice to allow prefix notation to be sprinkled in
randomly. Perhaps another escape notation for that? Abuse quasiquote for
that feature?
Ed