News for hackers. Stuff that matters.
Re:Lisphp is a Lisp dialect written in PHP. by jimbokun on Monday July 05, 2010 @02:55PM (#1488831)
I mean, is there any way to get that efficiency from PHP data structures? I guess you could implement a linked list data structure from scratch, but that would likely limit inter-operability with the rest of PHP.
Re:Lisphp is a Lisp dialect written in PHP. by tiles on Monday July 05, 2010 @04:26PM (#1489019)
cdr could return an array "object" where it references the entire array, and a pointer where it should start indexing. Instead of using linked-lists as the fundamental datatype, it could use array subsets.
Re:Lisphp is a Lisp dialect written in PHP. by koenigdavidmj on Tuesday July 06, 2010 @01:08AM (#1490028)
If I recall correctly, Clojure does something like this on most of its basic types. Since it wants users to avoid in-place modifications, it provides data structures that have modification functions that return new instances of the data structure with the changes made. These also do not regenerate the whole structure; they only use memory to point to the one modified/added element.

Please correct me if this is false.

Re:Lisphp is a Lisp dialect written in PHP. by gtani on Tuesday July 06, 2010 @02:22AM (#1490151)
Re:Lisphp is a Lisp dialect written in PHP. by Scriptor on Monday July 05, 2010 @10:48PM (#1489796)
Something like this could be very feasible, especially when combined with the array interfaces so that the fact it's an object with a moving pointer isn't even noticed.