Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • avg() for getting the average over a list

    uniq() for returning unique values from a list

    uniq_ordered() for returning unique values from a list in the order that they were first seen

    stats() which will return max, min, ave, tot, count for a list

    See http://www.perlmonks.org/?node_id=407834 for background.

    Cheers
    L~R
    • avg is already getting dangerously close to statistical functionality. Not that this would be fundemantally wrong in a list-module, but then people might come and ask for functions to calculate the quadratic mean or geometric mean as well.

      As for uniq and uniq_ordered, the first is no more computational work than the second from an XS point of view (as there are no hash-slices in C so one needs to loop anyway). uniq I could add.

      I am not convinced that stats is so terribly useful. max and min are already in List::Util and tot is really List::Util::sum.

      See http://www.perlmonks.org/?node_id=407834 for background.

      I'd have to think about the idea of function generators as exemplified in the above. That way they can be used in an incremental fashion...but it also makes them more complex (a lot more complex in XS).