Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: An iterator for (not "iterating") a recursive data structure.

by LanX (Archbishop)
on Jul 09, 2019 at 08:46 UTC ( #11102587=note: print w/replies, xml ) Need Help??


in reply to Re^3: An iterator for (not "iterating") a recursive data structure.
in thread An iterator for (not "iterating") a recursive data structure.

We had this conversation already four years ago ;)

Re^2: An iterator for (not "iterating") a recursive data structure.

Update

Push Re: list context (iterators)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^4: An iterator for (not "iterating") a recursive data structure.

Replies are listed 'Best First'.
Re^5: An iterator for (not "iterating") a recursive data structure.
by Eily (Monsignor) on Jul 09, 2019 at 09:29 UTC

    ... OK, I'll have to seriously train myself to use that idiom.

      To be fair, the semi predicate problem will still show up if you want an empty array to be a valid return value.

      But there are ways to fix it:

      • return an array ref hence a scalar
      • throw an exception via die and catch it with eval block (or better Try::Tiny )
      • do a goto to an external label named FINISHED or similar (totally undervalued option)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        Are you you talking about iterators that return a possibly empty list of items? Just have it return an array reference!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11102587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2020-05-31 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (173 votes). Check out past polls.

    Notices?