Toby Inkster
  • Open Source
  • Portfolio
  • Hire
  • Blog
  • Contact
Home » Blog » 2020 » October » 02 » Applying Operators to Coderefs

Applying Operators to Coderefs

Date: 02/10/2020
Categories: Perl
Tags: perl, Sub-Operable
Original: http://blogs.perl.org/users/toby_inkster/2020/10/applying-operators-to-coderefs.html

In algebra, there’s this pretty funky concept:

(f+g)(x) = f(x) + g(x)

And I was thinking if $f and $g were coderefs, what could $f + $g be?

It turns out with a little bit of overload magic, you can get coderefs to behave pretty much how functions do in algebra.

Sub::Operable is on CPAN.

Recent Blog Posts

  • Happy New Year
  • Dummy’s Guide to Roots Sage Theme in WordPress
  • WordPress wp-ctrl-semicolon Plugin
  • Thank You, Coveralls.io
  • Finding Squares in Matrices
  • Applying Operators to Coderefs

Copyright © 2020 Toby Inkster. All rights reserved.

Toby Ink Ltd is a registered company in England and Wales with company number 12533297.