I've finally got back to working through the output of the new PS, and have hit another couple of errors. The following form:
(lambda (x)
(apply (lambda (y) (bar (1+ y))) x))
...compiles to...
function (x) {
return function (y) {
return bar(y + 1);
}.apply(this, x);
};
... which is a syntax error. Earlier PS put parentheses around the inner function, which is correct:
function (x) {
return (function (y) {
return bar(y + 1);
}).apply(this, x);
};