A couple of weeks back I mentioned this book that I wanted to get:
“Higher-Order Perl: Transforming Programs with Programs” (Mark Jason Dominus)
A friend got their copy first and kindly loaned it to me (mine arrives Friday). The first 3 chapters covering recursion, dispatch tables and memoization respectively are kind of alright. Not particularly interesting to me because I’ve used these techniques in the part.
Chapter 4 is where it starts to get interesting for me.
This simple example has made me think about Perl a little differently:
sub upto { my ($m, $n) = @_; return sub { $m <= $n ? $m++ : undef; };}
I’m a quarter of the way through chapter 4. MJD’s solution to permutation makes the normal interviewing solution to that question seem ugly in comparison [Here’s a hint: it uses iterators! Read the book for the solution]