Added length, @, mapcar utility functions, exported all library function symbols.
[clinton/parenscript.git] / src / lib / js-lib.lisp
1 (in-package :parenscript)
2
3 ;;; Script of library functions you can include with your own code to
4 ;;; provide standard Lisp functionality.
5
6 (defparameter *ps-lisp-library*
7 '((defun mapcar (fun &rest as)
8 (let ((result-array (make-array)))
9 (if (= 1 (length as))
10 (dolist (element (aref as 0))
11 (result-array.push (fun element)))
12 (dotimes (i (length (aref as 0)))
13 (let ((args-array (mapcar (lambda (a) (return (aref a i))) as)))
14 (result-array.push (fun.apply fun args-array)))))
15 (return result-array)))))