[parenscript-devel] A PS version of NCONC

Daniel Gackle danielgackle at gmail.com
Wed Mar 3 05:17:04 UTC 2010


I needed a destructive append to a JS array, so I wrote this version of
NCONC for PS. It's primitive, but does what I need.

(defun nconc (arr &rest arrs)
    (when (and arr (> (length arr) 0))
      (loop :for other :in arrs :when (and other (> (length other) 0)) :do
        ((@ arr :splice :apply) arr
         (append (list (length arr) (length other)) other))))
    arr)

I suppose this would naturally go in some kind of runtime library for PS.
(We have quite a few utility functions that might belong there, in fact.)
But I don't think there is one anymore. Should there be?

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20100302/525ac83f/attachment.html>


More information about the parenscript-devel mailing list