Skip to content

Commit

Permalink
Comment for the future
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnlaffan committed Oct 15, 2023
1 parent 65f2288 commit 64d3b81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Biodiverse/Indices/RWTurnover.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use feature 'refaliasing';
no warnings 'experimental::refaliasing';

use Carp;
use List::Util qw /sum/;
use List::Util qw /sum reduce/;

our $VERSION = '4.99_001';

Expand Down Expand Up @@ -63,6 +63,9 @@ sub calc_rw_turnover {
# or inverse of ranges
my $cache
= $self->get_cached_value_dor_set_default_href ('_calc_phylo_rwt_pairwise_branch_sum_cache');
# Could use a reduce call to collapse the "sum map {} @list" idiom,
# thus avoiding a list generation. These are only run once per group,
# though, so it might not matter.
my $sum_i = $cache->{(keys %{$args{element_list1}})[0]} # use postfix deref?
//= (sum map {1 / $_} @ranges{keys %list1}) // 0;
my $sum_j = $cache->{(keys %{$args{element_list2}})[0]}
Expand Down

0 comments on commit 64d3b81

Please sign in to comment.