Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

pissed off about functional programming

by mstone (Deacon)
on Apr 24, 2005 at 11:46 UTC ( [id://450922]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        ^f(x) ::= x f(x)
    
  2. or download this
        0   - f(x)
        1   - x f(x)
        2   - x x f(x)
        3   - x x x f(x)
        ...
    
  3. or download this
        ^g(x) ::= x x
    
  4. or download this
        g(f(x))
    
  5. or download this
        0   - g(f(x))
        1   - f(x) f(x)
        2   - x f(x) x f(x)
        3   - x x f(x) x x f(x)
        ...
    
  6. or download this
        my $x = 3;
        my $y = 3;
    ...
        if (3 == $y) {                  # substitutability fails
            print "$x equals $y.\n";
        }
    
  7. or download this
        my $x = 3;      # start frame of reference for variable $x
                        # start frame of reference for value $x==3
    ...
                        # end frame of reference for variable $x
                        # end frame of reference for value $y==3
                        # end frame of reference for variable $y
    
  8. or download this
        p1  ::= 'the morning star' equals 'the planet venus'
        p2  ::= 'the evening star' equals 'the planet venus'
    ...
                the same thing, equal each other'
    
        =>  ::= an operator which means 'this rule produces this result'
    
  9. or download this
        p1 (+) p2 => p3
        p1 (+) p3 => p2
        p2 (+) p3 => p1
    
  10. or download this
        j1  ::= john knows 'the morning star' equals 'the planet venus'
        j2  ::= john knows 'the evening star' equals 'the planet venus'
        j3  ::= john knows 'the morning star' equals 'the evening star'
    
  11. or download this
        j1 (+) p2 => j3
        p1 (+) j2 => j3
    ...
        p1 (+) j3 => j2
        j2 (+) p3 => j1
        p2 (+) j3 => j1
    
  12. or download this
        sub outer_1 {
            local ($x) = 1;
    ...
            my $y = shift;
            return ($x + $y);
        }
    
  13. or download this
        sub equals {
            my ($str, $num) = @_;
    ...
                return 0;
            }
        }
    
  14. or download this
        my $inc  = sub { return ($_[0] + 1) };
        my $dec  = sub { return ($_[0] - 1) };
    ...
        ----
        
        output == '0 1 2 3 2 3 2 1 2 0 1 2 3'
    
  15. or download this
        sub apply {
            my ($val, $func, @etc) = @_;
    ...
                return ($func->($val));
            }
        }
    
  16. or download this
        my @x = ($inc, $inc, $inc);
        my @y = ($inc, $inc, $inc);
    ...
               printf "%d equals %d.\n", counter (@x), counter (@y);
            }
        }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found