You are looking at historical revision 39572 of this page. It may differ significantly from its current revision.
Outdated egg!
This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
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!, merge!, merge-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-blit! :: VFROM * I * END * VTO * J] -> V[procedure] u8vector-blit! :: VFROM * I * END * VTO * J] -> V
[procedure] s16vector-blit! :: VFROM * I * END * VTO * J] -> V
[procedure] u16vector-blit! :: VFROM * I * END * VTO * J] -> V
[procedure] s32vector-blit! :: VFROM * I * END * VTO * J] -> V
[procedure] u32vector-blit! :: VFROM * I * END * VTO * J] -> V
[procedure] f32vector-blit! :: VFROM * I * END * VTO * J] -> V
[procedure] f64vector-blit! :: VFROM * I * END * VTO * J] -> V
Copies subvector VFROM[I,END) into VTO[J,J+(END-I)).
[procedure] s8vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB[procedure] u8vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
[procedure] s16vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
[procedure] u16vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
[procedure] s32vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
[procedure] u32vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
[procedure] f32vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
[procedure] f64vector-merge! :: ELT< * VA * P * Q * R * VB * N -> VB
Given vector VA and indices P, Q, R such that P < Q < R, merges subvector VA[P,Q) and subvector A[Q,R) into vector B[N,N+(R-P)). The comparison function ELT< must be of type ELT< :: i1 * V(i1) * i2 * V(i2) -> boolean.
[procedure] s8vector-quick-sort! :: ELT< * V -> V[procedure] u8vector-quick-sort! :: ELT< * V -> V
[procedure] s16vector-quick-sort! :: ELT< * V -> V
[procedure] u16vector-quick-sort! :: ELT< * V -> V
[procedure] s32vector-quick-sort! :: ELT< * V -> V
[procedure] u32vector-quick-sort! :: ELT< * V -> V
[procedure] f32vector-quick-sort! :: ELT< * V -> V
[procedure] f64vector-quick-sort! :: ELT< * V -> V
where ELT< :: i1 * V(i1) * i2 * V(i2) -> boolean
[procedure] s8vector-merge-sort! :: ELT< * V -> V[procedure] u8vector-merge-sort! :: ELT< * V -> V
[procedure] s16vector-merge-sort! :: ELT< * V -> V
[procedure] u16vector-merge-sort! :: ELT< * V -> V
[procedure] s32vector-merge-sort! :: ELT< * V -> V
[procedure] u32vector-merge-sort! :: ELT< * V -> V
[procedure] f32vector-merge-sort! :: ELT< * V -> V
[procedure] f64vector-merge-sort! :: ELT< * V -> V
where ELT< :: 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! (lambda (i1 v1 i2 v2) (< v1 v2)) (f64vector 1 4 2 3) ) #f64(1.0 2.0 3.0 4.0)
About this egg
Author
Version history
- 1.9
- Added merge! and merge-sort! procedures
- 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-2013 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/>.