FWIW, there's an implementation of a doubly linked list in the SPL.
http://www.php.net/manual/en/class.spldoublylinkedlist.php
LispHP seems to use ArrayObject, though I'm not really sure how its performance is (googling indicates iteration is slow).
Re:Lisphp is a Lisp dialect written in PHP.
by arghnoname on Monday July 05, 2010 @01:02PM
(#1488613)
Is that written in C? Implementing a linked list in PHP isn't difficult, but I'd imagine memory use would be prohibitively expensive. If that is not written as a C extension, and perhaps even if it is, presumably you'd get a big speedup if you implemented a list with common lisp operations in mind as an extension for a project like this. It could fall back to a PHP implementation if the extension is not/can not be loaded.
It's kind of moot because if speed were a huge concern, this might not be used in the first place, but just it would be interesting to see how far such a thing could be taken.
Re:Lisphp is a Lisp dialect written in PHP.
by jonursenbach on Monday July 05, 2010 @01:30PM
(#1488670)
All SPL classes/methods are written in PHP. They're essentially PEAR classes that just come preinstalled.
Incorrect. The SPL is entirely implemented in C.
Re:Lisphp is a Lisp dialect written in PHP.
by jonursenbach on Monday July 05, 2010 @03:06PM
(#1488854)
Huh interesting.
s/entirely/also/
Re:Lisphp is a Lisp dialect written in PHP.
by arghnoname on Monday July 05, 2010 @04:51PM
(#1489069)
Ah, that's why my memory was fuzzy. I downloaded PHP and as of 5.3, the SPL does come with a double linked list, and a userland and C implementation are both in the tarball. Why is there a PHP version also?
Of course, because of the whole shared hosting thing you'd have to fall back to a pure PHP implementation if the extension isn't loaded.