Help for this page

Select Code to Download


  1. or download this
    sub infix:<!*> (&f, &g) {
            return sub ($x)  {
                    return f(g($x));
            };
    }
    
  2. or download this
    sub test ($x) {
            return $x ~ " test";
    ...
    
    # outputs (&test !* &test) test test
    say (&test !* &test)('&test !* &test');
    
  3. or download this
    # Fails with too much recursion
    say (&test !* (&test !* &test))('&test !* &test !* &test');
    
  4. or download this
    my $p = &test !* &test;
    my $q = $p !* &test;
    ...
    say $p('$p = &test !* &test');
    #should be $p !* test test test (?),  but says $p !* test test
    say $q('$p !*  &test');
    
  5. or download this
    function comp(f, g){
            return function(x){
    ...
    }
    
    print (comp(test,comp(test,test))("test "));
    
  6. or download this
    sub comp {
            $f = shift;
    ...
            return (shift) . " test";
    }
    print comp(\&test, comp(\&test,\&test))->("test ");
    
  7. or download this
    sub comp {
            my ($f, $g) = @_;
    ...
            return (shift) . " test";
    }
    print comp(\&test, comp(\&test,\&test))->("test ");