Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: I refuse to explain this

by strredwolf (Chaplain)
on Apr 09, 2001 at 08:13 UTC ( [id://70921]=note: print w/replies, xml ) Need Help??


in reply to Re: I refuse to explain this
in thread I refuse to explain this

I did. But I'll agree that it's helps shorten it (sub in regexp?).

But expanding $_ out does make it look like you're doing a virtual machine inside of the s///ex regexp. Source code (or is it VM machine code?) and a state engine, like my own obfusc.

--
$Stalag99{"URL"}="http://stalag99.keenspace.com";

Replies are listed 'Best First'.
Re: I refuse to explain this
by Dominus (Parson) on Apr 09, 2001 at 20:18 UTC
    Says strredwolf:
    But expanding $_ out does make it look like ... a state engine,
    (Shrug.) All I can do is to repeat that it isn't a state engine. In fact, I'm at something of a loss to imagine where you think the state variable is.

      $d and $q. The loop, of course, is conditional on $N.

      --
      $Stalag99{"URL"}="http://stalag99.keenspace.com";

        Says strredwolf:
        $d and $q.
        OK, that just makes no sense at all. A state variable has to record state. The only thing $q is used for is to match the subtitution on the right side of the s{}{} with the pattern on the left. It's just a table lookup. In fact, an earlier version of the program omitted $q and just had:

        redo if s/`I($z)/$1/; redo if s/``K($z)($z)/$1/; redo if s/```S($z)($z)($z)/``$1$3`$2$3/; ...
        I think the program probably would work fine with that change, although it would be less interesting. (It would sometimes go into an infinite loop for most interesting values of $_.)

        As for $d, it's only used internal to the regex itself, so it's obviously impossible that it could be a state variable.

        The loop, of course, is conditional on $N.
        Of course, but $N never takes on any value except 0 or 1. State machines are normally understood to have more than two states.

        If what you're saying is that this is a state machine because it uses variables, then Oracle 8 is also a mere state machine.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-26 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found