In the examples of Craig the argument of floor() is already a PDL, but the
confusion arises when floor is applied to a perl scalar. If I take another
common function, say cos() and apply it to a perl scalar I get a perl
scalar, and if I apply it to a PDL I get a PDL. Isn't that less surprising
than floor() making conversions?
Best regards,
Luis


On Wed, Jan 11, 2012 at 9:45 PM, Craig DeForest
<[email protected]>wrote:

> It would be even more surprising if floor() returned a PDL in most (but
> not all) cases.  Then you could not say (for example)
>        $a->inplace->floor->indexND($b); # would crash
> or (just as bad but more subtly)
>        $a->inplace->floor += 5; # would crash or silently do nothing
> (depending on perl version)
> without breakage.
>
> If there is any irregularity, it is in PDL::new_from_specification, but I
> still think that idiom is a good DWIMism.
>
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to