This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: vectors of integers



> > How does one assert (with libguile) that an SCM object is a vector whose 
> > components are unsigned integers?
> 
> That's exactly the problem that I faced with guile-gtk.  Basically,
> you have to iterate over all elements of the vector and check each if
> its of the appropriate type.
> 
> Then there are `uniform arrays'.  I don't know too much about them,
> only that they might be the right thing to use here.  The elements of
> an uniform array are restricted to a single type.  So you don't need
> to check them individually, and you can probably even avoid the
> conversion.

For my netcdf guile wrappers, I use uniform arrays, and they work
fine. The netcdf-guile primitives accept any vector as a valid
argument, and I call scm_make_uniform(), which will convert the vector
to a uniform array if it is not already (and check the args - I
think).

So, it works fine with regular vectors, but is more efficient if
called with uniform arrays.

					cheers,
					glenn.