[parenscript-devel] FLATTEN no longer supports dotted lists

sblist at me.com sblist at me.com
Thu Jun 4 01:39:04 UTC 2009


Hi folks,

We have some code that fails during ps-macroexpansion
time as a result of the following change in src/utils.lisp:

Previous definition (works):

(defun flatten (x &optional acc)
  (cond ((null x) acc)
        ((atom x) (cons x acc))
        (t (flatten (car x) (flatten (cdr x) acc)))))

Current definition (crashes):

(defun flatten (x)
  (if (atom x)
      (list x)
      (mapcan #'flatten x)))

The failing call in the backtrace is (FLATTEN (IE . 6)),
with a type error: 6 is not of type LIST. This is expected,
given that current definition of FLATTEN calls MAPCAN.

FLATTEN is only being called when the PS macro that
fails to expand, BROWSER-CASE, is wrapped in a LET
form:

 > (ps (browser-case '(:ie . 6) 'foo :default 'bar))
"'bar';"

 > (ps (let ((baz (browser-case '(:ie . 6) 'foo :default 'bar)))
                baz))

; Evaluation aborted. (Failure)

- Scott




More information about the parenscript-devel mailing list