in reply to Re^3: Specializing Functions with Currying
in thread Specializing Functions with Currying
Why limit compose to just two functions?
sub compose { my ($f, $f2, @rest) = @_; return $f unless defined $f2; return &compose(sub { $f2->($f->(@_)) }, @rest); } *bold_italic_and_underlined_paragraph = compose( &curry(\&wrap_with_html, 'u'), &curry(\&wrap_with_html, 'b'), &curry(\&wrap_with_html, 'i'), &curry(\&wrap_with_html, 'p') ); print bold_italic_and_underlined_paragraph("test");
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Specializing Functions with Currying
by Aristotle (Chancellor) on Aug 06, 2004 at 22:55 UTC | |
Re^5: Specializing Functions with Currying
by jryan (Vicar) on Aug 06, 2004 at 21:03 UTC | |
by stvn (Monsignor) on Aug 06, 2004 at 21:56 UTC | |
by jryan (Vicar) on Aug 06, 2004 at 22:21 UTC | |
by tilly (Archbishop) on Aug 06, 2004 at 22:29 UTC | |
by hardburn (Abbot) on Aug 09, 2004 at 13:08 UTC | |
| |
by stvn (Monsignor) on Aug 06, 2004 at 23:04 UTC | |
by jryan (Vicar) on Aug 06, 2004 at 23:20 UTC | |
| |
by ihb (Deacon) on Aug 08, 2004 at 00:19 UTC |