3 use Test::More tests => 10;
5 use warnings FATAL => 'all';
8 use Function::Parameters;
26 ) ##AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
35 fun mymap($fun, @args) :(&@) {
38 push @res, $fun->($_);
44 $n < 2 ? 1 : $n * fac_1 $n - 1
48 $n < 2 ? 1 : $n * fac_2 $n - 1
52 ok id_1(1), 'basic sanity';
53 ok id_2 1, 'simple prototype';
54 ok id_3(1), 'definition over multiple lines';
55 is add(2, 2), 4, '2 + 2 = 4';
56 is add(39, 3), 42, '39 + 3 = 42';
57 is_deeply [mymap { $_ * 2 } 2, 3, 5, 9], [4, 6, 10, 18], 'mymap works';
58 is fac_1(5), 120, 'fac_1';
59 is fac_2 6, 720, 'fac_2';
60 is fun ($x, $y) { $x . $y }->(fun ($foo) { $foo + 1 }->(3), fun ($bar) { $bar * 2 }->(1)), '42', 'anonyfun';