On Wed, Sep 26, 2012 at 11:15 AM, Craig DeForest <[email protected]> wrote: > Yes, PDL does distinguish between scalars (0 dimensions) and 1-element, > 1-dimensional PDLs. So do pretty much all languages that keep track of > multidimensional structured arrays. PDL goes to great lengths to do "what > you meant" in most cases -- e.g. if you treat an <n>-dimensional PDL as > <n+1>-dimensional, it is often assumed to have the extra dimension, of size > one. It is possible to go a long time without ever having to deal with that > distinction directly. > > The main place I've had to deal with that lately is that there's no such > thing as a 0-dimensional empty PDL. The way you make a structured Empty is > to generate a PDL with size 0 in one of its dimensions - but a scalar PDL > doesn't have any dimensions to set to 0. (That makes sense mathematically too > -- scalars aren't structured collections of things, they're atoms - so you > can't have zero atoms in a scalar)
Obviously I've managed to go *really* far without ever noticing. You can even call "stats" on a scalar piddle. The only methods of which I am aware that differentiates between scalar and one-element structured piddles are "dims" (and "getdims") and "ndims" (and "getndims"). Are there others? Would you mind if I made a note of this in the docs for these methods? David -- "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 [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
