Hi again, I sent this to the PDLPorters list, but it seems that it didn't take. I'm resending to the perldl list and if that doesn't work, I'm not sure what's up.
Cheers, Joel ---------- Forwarded message ---------- From: Joel Berger <[email protected]> Date: Fri, Aug 17, 2012 at 1:22 PM Subject: A slightly cleaner slice without source filters To: pdl-porters <[email protected]> Hi all, David knows that I don't use NiceSlice because I worry about source filters, probably more than I should. Still given the recent problem on the list, I thought I would look again at the other options. I keep thinking that I want to drop a note to the developers of Devel::Declare to see if I could hook into the scalar opcode rather than keyword as D::D does now; if I could get that, then a NiceSlice would be easy to implement. Absent that, I hacked out this little thing this morning which saves 5 keystrokes. (see at gist: https://gist.github.com/3379468) #!/usr/bin/env perl use strict; use warnings; package PDL; use overload '&{}' => sub { my $pdl = shift; return sub { unshift @_, $pdl; goto &PDL::slice }; }; package main; use PDL; my $a = xvals(5,5); print $a->('(0),'); What do you all think? Joel _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
