commit 8363fc8b036459685e84dbb45159327dd5f7aee2 parent a75730c8e44e52d2df37de85115a28d58e613bd2 Author: Samir Parikh <noreply@samirparikh.com> Date: Fri, 28 Jan 2022 16:02:22 +0000 get all tests to pass Diffstat:
M | strain/Strain.pm | | | 12 | ++++++++++-- |
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/strain/Strain.pm b/strain/Strain.pm @@ -6,12 +6,20 @@ our @EXPORT_OK = qw<keep discard>; sub keep { my ( $input, $function ) = @_; - return undef; + my @keep; + foreach ( @{ $input } ) { + push @keep => $_ if $function->($_); + } + return \@keep; } sub discard { my ( $input, $function ) = @_; - return undef; + my @discard; + foreach ( @{ $input } ) { + push @discard => $_ unless $function->($_); + } + return \@discard; } 1;