List operations test. The following describes the behaviour of every program:
- Create a list (L1) of integers from 1 through SIZE.
- Copy L1 to L2 (can use any builtin list copy function, if available)
- Remove each individual item from the left side (head) of L2 and append it to the right side (tail) of L3 (preserving order). (L2 should be emptied by one item at a time as that item is appended to L3).
- Remove each individual item from the right side (tail) of L3 and append it to the right side (tail) of L2 (reversing list). (L3 should be emptied by one item at a time as that item is appended to L2).
- Reverse L1 (preferably in place) (can use any builtin function for this, if available).
- Check that first item of L1 is now == SIZE, and compare L1 and L2 for equality and return length of L1 (which should be equal to SIZE).
This quite contrived test attempts to execise different list operations, like append, pop, copy, reverse in place. There is no by index access, so languages with lists internally implemented as arrays should not perform better, but probably worse due to the presence of pop from left operations. Languages implementing many basic list operations as built-ins may have some significant advantage.
Input argument meaning
In this test the argument specify the list length (called SIZE in the test's description).
Last updated: Sun Jan 18 11:15:31 CET 2004