You are looking at historical revision 25596 of this page. It may differ significantly from its current revision.
srfi-4-utils
Utility functions for SRFI-4 vectors.
Usage
(require-extension srfi-4-utils)
Documentation
srfi-4-utils contains a set of convenience procedures for SRFI-4 vectors: fold, map, quick-sort!.
Procedures
[procedure] s8vector-fold :: F * X0 * V [* V1 ... VN] -> XN[procedure] u8vector-fold :: F * X0 * V [* V1 ... VN] -> XN
[procedure] s16vector-fold :: F * X0 * V [* V1 ... VN] -> XN
[procedure] u16vector-fold :: F * X0 * V [* V1 ... VN] -> XN
[procedure] s32vector-fold :: F * X0 * V [* V1 ... VN] -> XN
[procedure] u32vector-fold :: F * X0 * V [* V1 ... VN] -> XN
[procedure] f32vector-fold :: F * X0 * V [* V1 ... VN] -> XN
[procedure] f64vector-fold :: F * X0 * V [* V1 ... VN] -> XN
where F :: V(I) [ * V1(I) ... VN(I)] * AX -> AX
[procedure] s8vector-map :: F * V [ * V1 ... VN] -> V[procedure] u8vector-map :: F * V [ * V1 ... VN] -> V
[procedure] s16vector-map :: F * V [ * V1 ... VN] -> V
[procedure] u16vector-map :: F * V [ * V1 ... VN] -> V
[procedure] s32vector-map :: F * V [ * V1 ... VN] -> V
[procedure] u32vector-map :: F * V [ * V1 ... VN] -> V
[procedure] f32vector-map :: F * V [ * V1 ... VN] -> V
[procedure] f64vector-map :: F * V [ * V1 ... VN] -> V
[procedure] s8vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] u8vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] s16vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] u16vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] s32vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] u32vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] f32vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
[procedure] f64vector-foldi :: F * X0 * V [ * V1 ... VN] -> XN
where F :: I * V(I) [ * V1(I) ... VN(I)] * AX -> AX
[procedure] s8vector-mapi :: F * V [* V1 ... VN] -> V[procedure] u8vector-mapi :: F * V [* V1 ... VN] -> V
[procedure] s16vector-mapi :: F * V [* V1 ... VN] -> V
[procedure] u16vector-mapi :: F * V [* V1 ... VN] -> V
[procedure] s32vector-mapi :: F * V [* V1 ... VN] -> V
[procedure] u32vector-mapi :: F * V [* V1 ... VN] -> V
[procedure] f32ector-mapi :: F * V [* V1 ... VN] -> V
[procedure] f64vector-mapi :: F * V [* V1 ... VN] -> V
where F :: I * V(I) [* V1(I) ... VN(I)] -> V
[procedure] s8vector-quick-sort! :: V * ELT< [ * START * END] -> V[procedure] u8vector-quick-sort! :: V * ELT< [ * START * END] -> V
[procedure] s16vector-quick-sort! :: V * ELT< [ * START * END] -> V
[procedure] u16vector-quick-sort! :: V * ELT< [ * START * END] -> V
[procedure] s32vector-quick-sort! :: V * ELT< [ * START * END] -> V
[procedure] u32vector-quick-sort! :: V * ELT< [ * START * END] -> V
[procedure] f32vector-quick-sort! :: V * ELT< [ * START * END] -> V
[procedure] f64vector-quick-sort! :: V * ELT< [ * START * END] -> V
where F :: i1 * V(i1) * i2 * V(i2) -> boolean
Examples
csi> (f64vector-map (lambda (v) (* 2 v)) (f64vector 1 2 3)) -> #f64(2.0 4.0 6.0) csi> (f64vector-fold (lambda (v ax) (+ v ax)) (f64vector 1 2 3) 0) -> 6.0 ;; input vector is modified csi> (f64vector-quick-sort! (f64vector 1 4 2 3) (lambda (i1 v1 i2 v2) (< v1 v2))) #f64(1.0 2.0 3.0 4.0)
About this egg
Author
Version history
- 1.6
- Documentation converted to wiki format
- 1.5
- Ported to Chicken 4
- 1.4
- Build script bug fix
- 1.3
- Build script updated for better cross-platform compatibility
- 1.2
- Extended fold and map interface to support multiple vector arguments
- 1.1
- Added foldi and mapi procedures
- 1.0
- Initial release
License
Copyright 2007-2010 Ivan Raikov and the Okinawa Institute of Science and Technology This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.