On Wednesday 07 July 2004 05:05, Kevin Cozens wrote: > On Tue, 2004-07-06 at 19:45, Sven Neumann wrote: > > The fact that the PDB uses arrays doesn't necessarily mean that a > > language binding such as Tiny-Fu needs to represent them as arrays. > > One of the most annoying bits of Script-Fu is that it forces you to > > work with arrays even though the natural choice for a scheme dialekt > > would be lists. If Tiny-Fu cannot provide backward-compatibility, then > > it should overcome this mistake and map the PDB API to lists. > > Tiny-Fu makes no attempt to provide backwards compatability with the > SIOD Scheme interpreter way of doing things. It expects scripts to > follow the current Scheme standard as defined in the R5RS document. > > Since the R5RS does not define an array type, any script which uses > arrays either internally or when dealing with PDB calls needs to be > modified to use a list. The marshalling code of Tiny-Fu converts between > PDB *ARRAY and Scheme lists as needed. The alternative would be to use a > Scheme vector but instead of a list. Using a list seemed like the > simplest approach. Are you sure using lists instead of vectors is the right thing to do? Lists are linked lists and as such accessing the i'th element is O(i). In vectors it is O(1). This can cause an order of complexity increase in handling them. Are you certain that all the scripts initialize the arrays, one element after another in sequential order? Or are there scripts with random access? In any case, this may not be an issue, because a programmer can temporarily use a vector, and convert it to a list before calling the PDB entries. (It reminds me that in Visual Basic the built-in array is implemented as a linked list, and so random access to it is slow as hell. What serious programmers do is implement the array logic in C and bind it to their VB programs) Regards, Shlomi Fish -- --------------------------------------------------------------------- Shlomi Fish shlomif@xxxxxxxxxxx Homepage: http://shlomif.il.eu.org/ Knuth is not God! It took him two days to build the Roman Empire.