Hi Tomas,

> strategy how it accesses the elements and by the time the function
> compare() is called, it already has the elements available so it does
> not have to "retrieve" them.

With "retrieve" I meant the raw data which are finally compared.

For example, look at the compare() method in "AlphanumComparator.java"
from your link "http://www.davekoelle.com/alphanum.html";.

Each time two objects are compared, there are string length()s
calculated, getChunk()s performed, the lengths of those chunks
calculated, and so on. This is done for both objects at each comparison.
And each time a given object is compared to another object, the
algorithm is performed again.

The code is also twice as long, needing s1.length() and s2.length(),
thisChunk = getChunk() and thatChunk = getChunk(). So I would expect a
unary function shorter and more to the point in general.

With the 'by' mechanism of PicoLisp, this retrieval of raw data is
performed only once for each object. The 'sort' routine then just has to
do the direct comparison of simple lisp structures.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to