Perl Monk, Perl Meditation | |
PerlMonks |
Re^4: [OT] Python to Perl.by BrowserUk (Patriarch) |
on Jun 15, 2018 at 18:47 UTC ( [id://1216742]=note: print w/replies, xml ) | Need Help?? |
It's a perfectly rational choice, you just have to know it. However, the weird thing with this particular conversion is that I originally converted for j in range(a[t - p] + 1, k): to for my $j ( $a[ $t - $p ] + 1 .. $k-1 ) { but the code didn't work and I had to switch it to for my $j ( $a[ $t - $p ] + 1 .. $k ) { to make it work. Here's my conversion:
I omitted the feature where the first parameter is inspected for being an integer and alphabet 0 .. k-1 is generated internally because it make using a none zero-based, or non-sequential integers alphabet impossible. Ie. supply k as '3579' and instead of being taken as an alphabet of 4 characters, it gets converted to a 3k letter alphabet and blows your memory. Besides, it's far simpler to create an sequence externally and pass it in. And I've made no attempt to optimise it, because now I have a working Perl version for comparison, I'll code a fast version in either Julia or C. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.
Suck that fhit
In Section
Seekers of Perl Wisdom
|
|