use strict;
use Language::Functional ':all';
sub _uc { uc shift } ;
sub bold { sprintf "%s", shift } ;
sub italics { sprintf "%s", shift } ;
my @telescope = (\&_uc, \&bold, \&italics) ;
my $o = foldl { my $seed = shift; my $func = shift; $func->($seed) }
"hello, world!", \@telescope;
warn $o;
# begin prototyped version --------------------------------------------------
use Class::Prototyped ':EZACCESS';
my $po;
$po = Class::Prototyped->new
(
uc_m => sub { uc $_[1] },
italics_m => sub { italics $_[1] },
bold_m => sub { bold $_[1] }
);
my @agenda = qw(uc_m italics_m);
my @agenda2 = qw(bold_m italics_m uc_m);
my $ret = foldl { my $seed = shift; my $meth = shift; $po->$meth($seed) }
"hello, world!", \@agenda;
warn $ret;
$ret = foldl { my $seed = shift; my $meth = shift; $po->$meth($seed) }
"hello, world!", \@agenda2;
warn $ret;