in reply to Re: sequence of positions to binary sequence
in thread sequence of positions to binary sequence
Thanks to autovivification, the direct calculation of max is unnecessary. To create an array whose final element is at the maximum position of a 1:
my @bits; $bits[$_] = 1 for @pos; for (0..($#bits-1)) { $bits[$_]=0 unless defined($bits[$_]); }
Best, beth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sequence of positions to binary sequence
by Utilitarian (Vicar) on Apr 16, 2009 at 10:42 UTC |