From bullard at stat.Berkeley.EDU  Wed May 12 20:18:16 2010
From: bullard at stat.Berkeley.EDU (James Bullard)
Date: Wed, 12 May 2010 11:18:16 -0700 (PDT)
Subject: [Rd] ranges and contiguity checking
Message-ID: <62125.66.201.56.150.1273688296.squirrel@www.stat.berkeley.edu>

Hi All,

I am interfacing to some C libraries (hdf5) and I have methods defined for
'[', these methods do hyperslab selection, however, currently I am
limiting slab selection to contiguous blocks, i.e., things defined like:
i:(i+k). I don't do any contiguity checking at this point, I just grab the
max and min of the range and them potentially do an in-memory subselection
which is what I am definitely trying to avoid. Besides using deparse, I
can't see anyway to figure out that these things (i:(i+k) and c(i, i+1,
..., i+k)) are different.

I have always liked how 1:10 was a valid expression in R (as opposed to
python where it is not by itself.), however I'd somehow like to know that
the thing was contiguous range without examining the un-evaluated
expression or worse, all(diff(i:(i+k)) == 1)

thanks, jim



[Rd] ranges and contiguity checking
James Bullard