I got bitten by this bug:
(ps (or x (if (= x 0) "zero" "empty"))) => "x || x == 0 ? 'zero' : 'empty'"
This is wrong, because it evaluates to 'zero' for any value of x, instead of just when x is 0. The correct expansion is:
x || (x == 0 ? 'zero' : 'empty')
It seems that Parenscript simply has JS operator precedence wrong for the "if" (question-mark) operator. The following web page (which claims to be reporting what the ECMA spec says) makes it clear that the "if" operator's precedence is between that of "or" and the assignment operators.
http://www.codehouse.com/javascript/precedence/
So a simple fix is:
hunk ./src/printer.lisp 110 - (in js-expression-if) + (in) hunk ./src/printer.lisp 118 + (js-expression-if)
Daniel