[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Uniform vectors, user survey
From: |
Marius Vollmer |
Subject: |
Re: Uniform vectors, user survey |
Date: |
Thu, 04 Nov 2004 18:48:38 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
Marius Vollmer <address@hidden> writes:
> I have close to zero experience with using uniform vectors myself, so
> I appreciate your input.
Thanks everybody for answering!
Here is where I am heading at the moment:
- The old uniform vector implementation are gone and the SRFI-4
homogenous vectors have taken over. This means that a bunch of
precious tc7 types are freed.
This brings some non-compatible changes to the C side, which I think
are reasonable. You can no longer use SCM_UVECTOR_BASE etc and of
course the tc7 tag messing is no longer needed.
- The C API of the SRFI-4 homogenous vectors has the two functions
scm_TAGvector_elements and scm_uniform_vector_release that allow
access to the raw memory of the vector. There is scm_take_TAGvector
to have Guile take over a memory block.
- Read and print syntax for arrays has been extended to also accept
the new "u8" etc tags and Guile can now print and read arrays with
non-zero lower bounds:
(make-array 0 '(1 2) '(2 3))
=> address@hidden@2((0 0) (0 0))
The "@address@hidden" means that the lower bounds are 1 and 2, respectively.
- The prototypes will be deprecated. Instead, make-uniform-array will
take a creator procedure; i.e, to get a u8 array you would do
(make-uniform-array make-u8vector 2 2)
=> #2u8((220 88) (48 64))
The array will not be initialized. You can use uniform-array-fill!
for that.
In place of array-prototype, which is deprecated, there is the new
array-creator.
- In addition to the types specified in SRFI-4, Guile also has c32 and
c64, which are floating point complex numbers of single and double
precision.
- vector? will be true for all zero-origin, one-dimensional arrays,
including uniform arrays except strings, bit vectors and suitable
shared arrays. Strings can be used with make-uniform-array but are
not accepted by vector? because R5RS says so. Also, vector-ref etc
will be suitably extended.
(Not implemented yet. This breaks with the tradition of RnRS to
have disjoint types. Maybe uniform vectors and general vectors
should remain disjoint? Opinions?)
- There will be some form of nice C API for uniform arrays.
- Re: Uniform vectors, user survey,
Marius Vollmer <=