in reply to Porting tqdm to Perl
IIRC are (should be?) all iterators in Python objects inheriting from a class Iteratable.
tqdm can just take one such object and return another enhanced iteratable one. (please correct me if I'm wrong)
Perl has a multitude of different iterators, finding a standard procedure to change them should be difficult.
I think the best way to go is to write tqdm into the loop (if it does what I understand)
for (1..100) { tqdm; # same as tqdm($_); ... }
Now the problem you'd be facing is extra code for initialisation, i.e. how can you tell that the loop was freshly entered or not?
IMHO the default answer in Perl is to initialize that tqdm right before the loop starts.
for my $outer (1..10) { my $tqdm = ProgressBar->new(); # or another constructor for (1..100) { &$tqdm; ... } }
Of course TIMTOWTDI, but I hope this helps.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Porting tqdm to Perl
by perlancar (Hermit) on Dec 21, 2018 at 14:07 UTC | |
by LanX (Saint) on Dec 21, 2018 at 14:11 UTC | |
by perlancar (Hermit) on Dec 21, 2018 at 14:19 UTC |