- or download this
sub infix:<!*> (&f, &g) {
return sub ($x) {
return f(g($x));
};
}
- or download this
sub test ($x) {
return $x ~ " test";
...
# outputs (&test !* &test) test test
say (&test !* &test)('&test !* &test');
- or download this
# Fails with too much recursion
say (&test !* (&test !* &test))('&test !* &test !* &test');
- 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');
- or download this
function comp(f, g){
return function(x){
...
}
print (comp(test,comp(test,test))("test "));
- or download this
sub comp {
$f = shift;
...
return (shift) . " test";
}
print comp(\&test, comp(\&test,\&test))->("test ");
- or download this
sub comp {
my ($f, $g) = @_;
...
return (shift) . " test";
}
print comp(\&test, comp(\&test,\&test))->("test ");