[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
doc srfi-4
From: |
Kevin Ryde |
Subject: |
doc srfi-4 |
Date: |
Wed, 11 Feb 2004 08:49:53 +1000 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) |
I think the srfi-4 docs would be clearer with each available function
named explicitly. I know it's a bit repetitive, but seeing TAGvector?
etc means you have to look for what TAG means, and also means emacs
info-look won't work.
I also think the separate sections for read syntax and the procedures
can be combined, the whole is still pretty short.
SRFI-4 - Homogeneous numeric vector datatypes
=============================================
SRFI-4 defines a set of datatypes and functions for vectors whose
elements are numbers, all of the same numeric type. Vectors for signed
and unsigned exact integers and inexact reals in several precisions are
available. Being homogeneous means they require less memory than
normal vectors.
The functions and the read syntax in this section are made available
with
(use-modules (srfi srfi-4))
Procedures similar to the vector procedures (*note Vectors::) are
provided for handling these homogeneous vectors, but they are distinct
datatypes and the two cannot be inter-mixed.
Ten vector data types are provided: Unsigned and signed integer
values with 8, 16, 32 and 64 bits and floating point values with 32 and
64 bits. The type is indicated by a tag in the function names, `u8',
`s8', `u16', `s16', `u32', `s32', `u64', `s64', `f32', `f64'.
The external representation (ie. read syntax) for these vectors is
similar to normal Scheme vectors, but with an additional tag
indiciating the vector's type. For example,
#u16(1 2 3)
#f64(3.1415 2.71)
Note that the read syntax for floating-point here conflicts with
`#f' for false. In Standard Scheme one can write `(1 #f3)' for a three
element list `(1 #f 3)', but with the SRFI-4 module `(1 #f3)' is
invalid. `(1 #f 3)' is almost certainly what one should write anyway
to make the intention clear, so this is rarely a problem.
- Scheme Procedure: u8vector? obj
- Scheme Procedure: s8vector? obj
- Scheme Procedure: u16vector? obj
- Scheme Procedure: s16vector? obj
- Scheme Procedure: u32vector? obj
- Scheme Procedure: s32vector? obj
- Scheme Procedure: u64vector? obj
- Scheme Procedure: s64vector? obj
- Scheme Procedure: f32vector? obj
- Scheme Procedure: f64vector? obj
Return `#t' if OBJ is a homogeneous numeric vector of the
indicated type.
- Scheme Procedure: make-u8vector n [value]
- Scheme Procedure: make-s8vector n [value]
- Scheme Procedure: make-u16vector n [value]
- Scheme Procedure: make-s16vector n [value]
- Scheme Procedure: make-u32vector n [value]
- Scheme Procedure: make-s32vector n [value]
- Scheme Procedure: make-u64vector n [value]
- Scheme Procedure: make-s64vector n [value]
- Scheme Procedure: make-f32vector n [value]
- Scheme Procedure: make-f64vector n [value]
Return a newly allocated homogeneous numeric vector holding N
elements of the indicated type. If VALUE is given, the vector is
initialized with that value, otherwise the contents are
unspecified.
- Scheme Procedure: u8vector value ...
- Scheme Procedure: s8vector value ...
- Scheme Procedure: u16vector value ...
- Scheme Procedure: s16vector value ...
- Scheme Procedure: u32vector value ...
- Scheme Procedure: s32vector value ...
- Scheme Procedure: u64vector value ...
- Scheme Procedure: s64vector value ...
- Scheme Procedure: f32vector value ...
- Scheme Procedure: f64vector value ...
Return a newly allocated homogeneous numeric vector of the
indicated type, holding the given parameter VALUEs. The vector
length is the number of parameters given.
- Scheme Procedure: u8vector-length vec
- Scheme Procedure: s8vector-length vec
- Scheme Procedure: u16vector-length vec
- Scheme Procedure: s16vector-length vec
- Scheme Procedure: u32vector-length vec
- Scheme Procedure: s32vector-length vec
- Scheme Procedure: u64vector-length vec
- Scheme Procedure: s64vector-length vec
- Scheme Procedure: f32vector-length vec
- Scheme Procedure: f64vector-length vec
Return the number of elements in VEC.
- Scheme Procedure: u8vector-ref vec i
- Scheme Procedure: s8vector-ref vec i
- Scheme Procedure: u16vector-ref vec i
- Scheme Procedure: s16vector-ref vec i
- Scheme Procedure: u32vector-ref vec i
- Scheme Procedure: s32vector-ref vec i
- Scheme Procedure: u64vector-ref vec i
- Scheme Procedure: s64vector-ref vec i
- Scheme Procedure: f32vector-ref vec i
- Scheme Procedure: f64vector-ref vec i
Return the element at index I in VEC. The first element in VEC is
index 0.
- Scheme Procedure: u8vector-ref vec i value
- Scheme Procedure: s8vector-ref vec i value
- Scheme Procedure: u16vector-ref vec i value
- Scheme Procedure: s16vector-ref vec i value
- Scheme Procedure: u32vector-ref vec i value
- Scheme Procedure: s32vector-ref vec i value
- Scheme Procedure: u64vector-ref vec i value
- Scheme Procedure: s64vector-ref vec i value
- Scheme Procedure: f32vector-ref vec i value
- Scheme Procedure: f64vector-ref vec i value
Set the element at index I in VEC to VALUE. The first element in
VEC is index 0. The return value is unspecified.
- Scheme Procedure: u8vector->list vec
- Scheme Procedure: s8vector->list vec
- Scheme Procedure: u16vector->list vec
- Scheme Procedure: s16vector->list vec
- Scheme Procedure: u32vector->list vec
- Scheme Procedure: s32vector->list vec
- Scheme Procedure: u64vector->list vec
- Scheme Procedure: s64vector->list vec
- Scheme Procedure: f32vector->list vec
- Scheme Procedure: f64vector->list vec
Return a newly allocated list holding all elements of VEC.
- Scheme Procedure: list->u8vector lst
- Scheme Procedure: list->s8vector lst
- Scheme Procedure: list->u16vector lst
- Scheme Procedure: list->s16vector lst
- Scheme Procedure: list->u32vector lst
- Scheme Procedure: list->s32vector lst
- Scheme Procedure: list->u64vector lst
- Scheme Procedure: list->s64vector lst
- Scheme Procedure: list->f32vector lst
- Scheme Procedure: list->f64vector lst
Return a newly allocated homogeneous numeric vector of the
indicated type, initialized with the elements of the list LST.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- doc srfi-4,
Kevin Ryde <=