Am Montag, 9. Oktober 2006 16:26 schrieb Karl Forner:
> AND YET OTHER QUESTIONS
>
> * What is the intended usage, or in other words, the usefulness of the
> *BooleanArrays ?

A *BooleanArray *does* array[1] and it's storage size is one bit per item.

[1] the current array interface isn't much more than:

Fixed:
  ar = 1e9     # fill it with 0
  b = ar[idx]  # get bit
  ar[idx] = b  # set bit 
  delete, exists

Resizable additionally:
  b = {pop,shift} ar
  {push,unshift} ar, b
  splice

To me it doesn't make much sense to provide all possible conversions from/to 
num & string, PMC is debatable.

For usage see e.g.: examples/shootout/nsieve*.pir  

> I'm somewhat puzzled, because there is no API for using these boolean
> arrays (a la Bit::Vector for example)

We don't have an array API yet, nor a pdd. But some methods like sort() are 
implemented for some arrays. fill() aka memset() would be another candidate. 
And of course more on demand.

> * If it's just a kind of storage, I can go on and implement it with a
> custom, simple and small implementation, but I've still 2 solutions for
> Resizables  :
>   - either grow smartly only on the right (push, pop), an alloc/copy when
> changes are needed on the left (that saves on INTVAL attribute)
>   - allocate a third INTVAL attribute on the heap, and grows smartly in
> both directions

You can provide smart growing in both directions with the mentioned strategy 
with just 2 int_val fields.

> Thank you very much for your attention
>
> Karl Forner

leo

Reply via email to