On Jul 3, 2009, at 4:35 AM, Eduardo Cavazos wrote:

Abdulaziz Ghuloum wrote:

A few questions:
1. You're not handing left/right associativity, right?

Eh... can you give an example? Or, does this help to clarify? :

    > (infix '(a + b - c))
    (- (+ a b) c)

What I mean is:

(infix '(a + b + c + d))
=> (+ (+ (+ a b) c) d)
because + is left associative, while

(infix '(a ^ b ^ c ^ d))
=> (^ a (^ b (^ c d)))
because ^ is right-associative.

Your code handles all operators as if they were all left associative.
The URL you gave explains how to handle right associative operators.

Aziz,,,

Reply via email to