Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Iterator Problem with recursion

by moot (Chaplain)
on Apr 26, 2005 at 17:08 UTC ( [id://451674]=note: print w/replies, xml ) Need Help??


in reply to Iterator Problem with recursion

Are you sure analyze is eventually returning? Seems to me if proccode() returns anything at all that the loop over @out will be executed, calling analyze once more, and so ad infinitum.

Update: Gah! didn't see that regexp conditional in there.. so it's unlikely that analyze() does not return at some point. In that event, is there a minimal test case that tickles this behaviour?

Replies are listed 'Best First'.
Re^2: Iterator Problem with recursion
by PetaMem (Priest) on Apr 26, 2005 at 17:43 UTC
    I am pretty sure, it does return. This routine (called "manal" in the system) is burried deep within a machine translation engine, I have here some log that visualizes the behaviour. The L1/L2 is a level counter I have installed to make sure I see when a level is entered and when exited.:
    sub manal { my $htree = shift; my $rul = shift; my $level = shift || 1; my $hist = (split /\n/, $htree->data)[0]; my $str = (split /\|/, $hist)[0]; my ($k, $v); $hist = "|$hist"; &log("entering manal L$level with history: $hist\n"); while(($k,$v) = each %$rul) { my @out = @{&proccode($str,$v)} for my $h (@out) { &log("debug: (out: @out - $h)/$str/$hist/$k\n"); &manal($htree->append("$h$hist\n$k"),$rul,$level+1) if($hist !~ +/\|$h\|/); } } &log("exiting manal L$level for STR: $str\n"); }

    Bye
     PetaMem
        All Perl:   MT, NLP, NLU

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-19 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found