I'm not sure where the 99% comes from but I definitely agree that if you add it to PDL::Lvalue and it works, things will probably work ok. Without more understanding on my part, I'll have to defer to other experts on lvalue routines and data-flowing piddles. :-)
--Chris On Mon, Sep 29, 2014 at 8:46 AM, David Mertens <dcmertens.p...@gmail.com> wrote: > This seems a tad bit too cautious to me. I would advise that if this works: > > ($tmp=$a->some_slice_method($n)).=$b > > but this fails: > > $a->some_slice_method($n).=$b; > > chances are 99% or better that merely adding the method to PDL::Lvalue will > work correctly. To be doubly sure, any proposed modification to PDL::Lvalue > should include a test, but I simply cannot imagine that any method that > returns a data-flowing piddle will fail if marked as lvalue. > > Maybe, just maybe, it could be an issue if the method is written in Perl > (not PDL::PP) and finishes with a "return $result" rather than simply > "$result" on Perls older than 5.20. But that would be caught by tests, is > easily fixed, and will (in about a decade) become a non-issue. > > David > > On Thu, Sep 25, 2014 at 4:45 PM, Chris Marshall <devel.chm...@gmail.com> > wrote: >> >> Seems like it ought to work but, again as before, I'm >> not sure enough of the implementation to determine >> if it should work or not. Maybe when Craig finishes >> his tutorial/explanation of how threading/slicing works... >> >> If adding to PDL::Lvalue works, then there is no value >> in using the alternatives. >> >> --Chris >> >> On Thu, Sep 25, 2014 at 4:23 PM, Luis Mochan <moc...@fis.unam.mx> wrote: >> > I found a similar issue with 'rotate'. I would like to be able to say >> > $a->rotate($n).=$b; >> > Would it be safe to add rotate to @funcs in PDL::Lvalue.pm? >> > >> > It seems that >> > ($tmp=$a->rotate($n)).=$b >> > works, as well as >> > $a->rotate($n)->(0:-1).=$b >> > Are these alternative better/safer? >> > >> > Best regards, >> > Luis >> > >> > >> > On Wed, Mar 26, 2014 at 08:47:51AM +0800, vine xf wrote: >> >> Oh great! After append 'reorder' to PDL::Lvalue.pm, it works as lvalue >> >> function now. Thanks! >> >> >> >> On Wed, Mar 26, 2014 at 7:44 AM, Chris Marshall >> >> <devel.chm...@gmail.com>wrote: >> >> >> >> > reorder() is not listed as an Lvalue subroutine. >> >> > See PDL::Lvalue for the list. It seems like it >> >> > should be but I'm not sure enough of the implementation >> >> > to determine if it will work as one. You could try >> >> > adding it to the PDL::Lvalue list and see if it works. >> >> > >> >> > --Chris >> >> > >> >> > >> >> > On Tue, Mar 25, 2014 at 7:24 PM, vine xf <xf929...@gmail.com> wrote: >> >> > > Hi, >> >> > > >> >> > > I got an error message while using PDL(2.007, ActivePerl5.16), but >> >> > > don't >> >> > > know >> >> > > why. Here's a simplified example: >> >> > > >> >> > > everything's ok for this code: >> >> > > use PDL; >> >> > > $a = sequence(5,6); >> >> > > $b = $a->reorder(1,0); >> >> > > $b .=0; # $a is all zeros now. >> >> > > >> >> > > but this code doesn't work: >> >> > > use PDL; >> >> > > $a = sequence(5,6); >> >> > > $a->reorder(1,0) .= 0; #Can't modify non-lvalue subroutine call at >> >> > > - >> >> > line 3, >> >> > > ... >> >> > > >> >> > > But methods like ->splice(...) could be assigned to without any >> >> > > problem. >> >> > Is >> >> > > there a subset of PDL method which can't be assigned to just like >> >> > reorder()? >> >> > > >> >> > > Xiaofang. >> >> > > >> >> > > >> >> > > _______________________________________________ >> >> > > Perldl mailing list >> >> > > Perldl@jach.hawaii.edu >> >> > > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> >> > > >> >> > >> > >> >> _______________________________________________ >> >> Perldl mailing list >> >> Perldl@jach.hawaii.edu >> >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> > >> > >> > -- >> > >> > o >> > W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) >> > Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ >> > /\ >> > Apdo. Postal 48-3, 62251 | (*)/\/ >> > \ >> > Cuernavaca, Morelos, México | moc...@fis.unam.mx /\_/\__/ >> > GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB >> > >> > >> > >> > _______________________________________________ >> > Perldl mailing list >> > Perldl@jach.hawaii.edu >> > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> >> _______________________________________________ >> Perldl mailing list >> Perldl@jach.hawaii.edu >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > > > > > -- > "Debugging is twice as hard as writing the code in the first place. > Therefore, if you write the code as cleverly as possible, you are, > by definition, not smart enough to debug it." -- Brian Kernighan _______________________________________________ Perldl mailing list Perldl@jach.hawaii.edu http://mailman.jach.hawaii.edu/mailman/listinfo/perldl