RosettaCodeData/Task/Function-composition/Perl/function-composition.pl

11 lines
153 B
Perl
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
sub compose {
my ($f, $g) = @_;
sub {
$f -> ($g -> (@_))
};
}
use Math::Trig;
print compose(sub {sin $_[0]}, \&asin)->(0.5), "\n";