Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Turing completeness and regular expressions

by JadeNB (Chaplain)
on Nov 28, 2009 at 04:32 UTC ( #809842=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -pe '
    BEGIN { my $term = qr/(S|K|\((?-1)(?-1)\))/ }
    ...
        s/\(\(\(S($term)\)($term)\)($term)\)/(($1$3)($2$3))/
    or  s/\(\(K($term)\)($term)\)/$2/;
    '
    
  2. or download this
    perl -Mre=eval -nE <<CODE
    chomp;
    ...
    /\^.*$/ or say( ( split /\n/ )[-1] ) while
        s/$c_rule(?:\n$nc_rule)*\n---\n.*?\K\1/$2/;
    CODE
    
  3. or download this
    1
    11
    ...
    11001110100011
    111010111100111
    ...
    
  4. or download this
    perl -Mre=eval -nE <<CODE
    chomp;
    ...
        s/$c_rule(?:\n+$nc_rule)*\n---\n.*?\K\1(.*?)\2(.*?)\3/$4$7$5$8$6/;
    say ( ( split /\n/ )[-1] );
    CODE
    
  5. or download this
    t ::= S
    t ::= K
    ...
    p ::= 'p
    p ::=
    t ::= `tt
    
  6. or download this
    `````S`KSKxx'x''             # B = S(KS)K
    `x`x'x''                     # Bxyz = x(yz)
    ...
    ``xx''x'                     # Cxyz = xzy
    ````SS`K``SKKxx'             # W = SS(K(SKK))
    ``xx'x'                      # Wxy = xyy
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://809842]
Approved by GrandFather
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2020-01-24 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?