in reply to currying CORE functions into closures?
Doesn't it just work?
...roboticusroboticus@swill $ cat 761397.pl #!/usr/bin/perl -w use strict; use warnings; sub morf { my ($tester, $testval, $true_word, $false_word) = @_; $tester->($testval) ? $true_word : $false_word; } sub se { my ($val) = @_; sub { $_[0] eq $val} } my $fr = se('M'); for my $FL (split /|/, "MNLOP") { print "FL=$FL, MORF=", morf($fr, $FL, 'Male', 'Female'), "\n"; } roboticus@swill $ ./761397.pl FL=M, MORF=Male FL=N, MORF=Female FL=L, MORF=Female FL=O, MORF=Female FL=P, MORF=Female Male Female Male
|
|---|