# # This software is Copyright 2005 by Elsevier Inc. You may use it # under the terms of the license at http://perl.plover.com/hop/LICENSE.txt . # ### ### fold ### ## Chapter 7 section 3 sub fold { my $f = shift; sub { my $x = shift; sub { my $r = $x; while (@_) { $r = $f->($r, shift()); } return $r; } } }