It's important when you need to write your own iteration primitives. Map, fold, etc are all well and good, but sometimes they won't do because the iteration may require some unusual steps.
In your particular dialect of lisp, what does the code for writing map or fold look like? The one that doesn't copy memory egregiously, that is. And how bad must the performance of javascript linked lists be to scare you away from them so damn hard, anyways?
Or perhaps, what you're supporting is a "lispish" language that isn't really something we should directly compare to lisp, in the vein of Nu?
This is map:
(defun map (fn arr) "Call FN on each element in ARR and return the returned values in a new array." ;; In newer versions of ECMAScript, this may call Array.map, too (let ((idx 0) (result (array))) (dolist (el arr) (setf (aref result idx) (fn el)) (setf idx (1+ idx))) (return result)))
This is reduce:
(defun reduce (func list &optional init) ;; the use of init here is actually a bit broken wrt null (let* ((acc)) (do* ((i (if init -1 0) (1+ i)) (acc (if init init (elt list 0)) (func acc (elt list i)))) ((>= i (1- (length list))))) (return acc)))
What would a linked list data structure provide? Incompatibility with all other JavaScript code and a mandatory runtime library?
Thanks for introducing me to Nu btw. What makes you say that it is not a Lisp?
This is map: http://github.com/dahlia/lisphp/blob/81849070ac7ff13948786b5...
This is filter: http://github.com/dahlia/lisphp/blob/81849070ac7ff13948786b5...
This is fold: http://github.com/dahlia/lisphp/blob/81849070ac7ff13948786b5...
Lisphp respect the iterator protocol of PHP instead of Lisp tradition in the practical reason.