Chris - The cynic in me would argue that this would be a non-issue with stricter namespacing, but I suppose that in the end one would have imported this method and run into the same problem even with stricter namespacing.
I think your idea makes sense, but I fear there is little we can do about it now. User code might depend on the result being a piddle. Perhaps we could implement this for PDL3, the non-backwards-compatible version of PDL that rocks the numerical community's world slated to come out Christmas (of some uspecified year). :-D David On Wed, Jan 11, 2012 at 3:13 PM, Chris Marshall <[email protected]>wrote: > I was writing some code to generate sequence vectors > of the appropriate dimensionality and I ran the following > sequence: > > pdl> $nmax = 1; > pdl> $nvec = sequence(floor($nmax+1)); > pdl> p $nvec > 0 > > which surprised me since I expected the result to > be [0,1] since floor($nmax+1) is 2. It turns out the > result is correct according to the documentation > _since_ the floor() routine generates a pdl output > value even if the input is a perl scalar. If you use > POSIX::floor instead, I get the expected result: > > pdl> $nvec = sequence(POSIX::floor($nmax+1)); > pdl> p $nvec > [0 1] > > Maybe the PDL::floor routine (and similar routines) > should return perl scalars when passed perl scalars > as input args instead of piddles. Goes to show > you, PDL can always surprise you! :-) > > --Chris > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > -- Sent via my carrier pigeon.
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
