wufnik has asked for the wisdom of the Perl Monks concerning the following question:

esteemed perl monks;

i have a number of scripts which rely on a pure perl implementation of PCCTS's old set library. I've found these reasonably useful, and have gone to the length of coding some funky classification algorithms (ART plus) which use them, and which i'm keen to post for others to use.

the problem is - i checked cpan, there are many many set modules. and i don't want to post another for the hell of it. none, apparently, are pure perl - i think. my module also implements some fast integer arithmetic routines (karatsuba mult etc), but given that perl 6 itself will do large int arithmetic, further doubts raise themselves in my mind. and then there are the obvious gripes about the speed of pure perl to think of.

the question really boils down to 3 questionlets:

how cleverly will perl 6 do its large integer arithmetic?

does anyone feel such a module would be useful?

are pure perl modules just masochism in disguise?

any views on the matter would be much appreciated.

gratefully yours,

...wufnik

-- in the world of the mules there are no rules --
  • Comment on pure perl + large integers + bitsets = dilemma

Replies are listed 'Best First'.
Re: pure perl + large integers + bitsets = dilemma
by fglock (Vicar) on Jun 17, 2003 at 00:00 UTC

    are pure perl modules just masochism in disguise?

    Set::Infinite is pure Perl and is reasonably fast. I can't say if it will serve your purposes, however. It does not rely in bit sets - it uses "spans" internally.

      thanks fglock. the use of bitsets is important because theoretically i can unions, intersections etc a little faster, in a little less space - and the sets can be large, and it needs to be *fast*, or i will spend all my time answering 'why did you do it this way when it is soooo slow' type questions.

      for 'sparse' sets, the approach your Set::Infinite takes is much more sensible, allowing it to do clever things with more complicated set types. i particularly like it's connection with dates, which seems a good idea. Quantum::Superpositions is something i should check out too, I guess.

      ...wufnik

      -- in the world of the mules there are no rules --
      Ok, I know it said "pure perl", but in case you are looking for a decent C implementation for Perl, look at Math::BigGMP. It's a drop in replacement for Math::BigInt.. Just throwing options for "related" questions..
Re: pure perl + large integers + bitsets = dilemma
by DrHyde (Prior) on Jun 17, 2003 at 15:13 UTC
    Pure-perl alternatives for XSish modules are always useful, for people stuck on Windows or Mac or similarly compiler-less systems. As for perl6 - it doesn't exist yet, and isn't expected any time soon. Don't wait to release stuff just because we'll get it in perl6.

    However, check to see that Math::Bigint doesn't already do what you want. It's part of the core in 5.8, and possibly in earlier versions, I disremember.