Buddha Buck wrote:
I was wondering...
How persistant are superpositions? How pervasive are they?
As I mentioned in a recent post, would expect them to be all-pervasive
and fully propagating.
I mean, will the following work?
I would certainly hope so! (modulo the syntax snafu)
In fact, it's hard to see how we could define superpositions sensibly and
yet have it could *not* work.
$letters = any('a'..'z');
$digits = any('0'..'9');
$ndaTable = {
start => { $letters => 'OneLetter',
$digits => 'OneDigit' }
OneLetter => { $letters => 'TwoLetter',
$digits => 'OneLetter'},
TwoLetter => { $letters => 'TriLetter,
$digits => 'TwoLetter'},
TriLetter => { $digits => 'TriLetter'),
OneDigit => { $letters => 'OneDigit',
$digits => 'TwoDigit'},
TwoDigit => { $letters => 'TwoDigit'}
}
for split(//,$instring) -> $input {
That's a high-precdence C<err> there, partner. You meant:
for split(/<null>/,$instring) -> $input {
$state = $ndaTable{$state}{$input};
last unless $state;
}
print "Input string $instring has more than 3 letters and 2 digits\m"
unless $state;
Damian
PS: Is anyone collecting these examples. It would make writing that perl.com
article much easier for me ;-)