January 1st, 2011, 4:27 pm
Tukhi has array manipulation functions. Most array functions take either an array or a handle to an array. If the argument is a handle, the array function operates on the in-memory array. Here is the money shot from SIEVE.DEMO:=IF(TUKHI.COUNT()>0, ARRAY.MASK(Sieve, MOD(ARRAY.GET(Sieve), CurPrime) + (ARRAY.GET(Sieve) = CurPrime)))When running a simulation (TUKHI.COUNT()>0) mask the sieve using the remainders when dividing by the current prime, but don't throw out the current prime. Here Sieve is a handle to an in-memory array. After the simulation is done, use ARRAY.GET(Sieve) to retrieve the prime numbers. Note that when using an Excel function (like MOD) we need to call ARRAY.GET on the handle since Excel does not know about Tukhi in-memory arrays.Try things out and see for yourself. Let me know if you run into any problems with the xll library or Tukhi.BTW, it is not clear to me how you would use ObjectHandler in Excel. E.g., if you delete a cell in Excel how would ObjectHandler know?