Bit::Grep - select elements from an array using a bit vector
use Bit::Grep qw(bg_grep bg_sum); my @selected = bg_grep $vec, @array; my $sum = bg_sum $vec, @array
This module provides some functions to select elements from and array using a bit vector.
Selects elements from @array using bit vector $vec as the selector.
It is equivalent to
@selected = @array[grep vec($vec, $_, 1), 0..$#array];
Returns the sum of the elements of @array selected by $vec.
Returns the average of the elements of @array selected by $vec.
Returns the number of elements selected and their sum
Returns the number of elements selected, their sum and the sum of their squares.
If you find any bug on this module, please send a bug request through the CPAN bug tracker https://rt.cpan.org/Dist/Display.html?Queue=Language-Prolog-Yaswi
Feedback or requests for new features are also welcome.
"vec" in perlfunc, "grep" in perlfunc, "sum" in List::Util.
Copyright (C) 2010 by Salvador Fandiño (sfandino@yahoo.com)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10 or, at your option, any later version of Perl 5 you may have available.
To install Bit::Grep, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bit::Grep
CPAN shell
perl -MCPAN -e shell install Bit::Grep
For more information on module installation, please visit the detailed CPAN module installation guide.