[parenscript-devel] FLATTEN no longer supports dotted lists
Vladimir Sedach
vsedach at gmail.com
Mon Jun 8 04:37:13 UTC 2009
I restored the previous definition of flatten. Thanks for the bug report!
Vladimir
On Wed, Jun 3, 2009 at 7:39 PM, <sblist at me.com> wrote:
> 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
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
More information about the parenscript-devel
mailing list