[parenscript-devel] A PS version of NCONC
Red Daly
reddaly at gmail.com
Wed Mar 3 22:55:38 UTC 2010
On Tue, Mar 2, 2010 at 9:17 PM, Daniel Gackle <danielgackle at gmail.com> wrote:
> 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?
I maintain a utility library: http://github.com/gonzojive/paren-util
You are welcome to add little functions like that to it--just use the
pull request feature on github.
The main Parenscript file can be browsed here:
http://github.com/gonzojive/paren-util/blob/master/src/paren/util.paren
I generally use ASDF to compile parenscript code from various
libraries into a single file
-- Red
>
> Daniel
>
> _______________________________________________
> 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