
From Iterative to Functional Perl 6 Code (2012) - brudgers
http://perl6maven.com/from-iterative-to-functional-perl6-code
======
pflanze
For those still interested in Perl 5: I've added a translation of the
functional example from this article to the functional-perl project(1) here:

[https://github.com/pflanze/functional-
perl/blob/master/examp...](https://github.com/pflanze/functional-
perl/blob/master/examples/existing_files)

(1) [http://functional-perl.org](http://functional-perl.org)

i.e.

    
    
        my $paths    = stream(qw< /tmp /var/tmp >);
        my $filename = 'temp123';
        my $ext      = list(qw<pod pm pl>);
        my $existing_files =
          $paths->cartesian_product(list("/$filename."), $ext)
                ->map(*list_to_string)
                ->filter(unary_operator "-e");

