[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.15 srfi-43 - ベクタライブラリ

Module: srfi-43

このモジュールはベクタ用のライブラリ関数を提供します。 SRFI-43のいくつかの関数は組み込みになっています。ベクタを見てく ださい。

ベクタ構成子

Function: vector-unfold f length seed …

[SRFI-43]

Function: vector-unfold-right f length seed …

[SRFI-43]

Function: vector-reverse-copy vec &optional start end

[SRFI-43]

Function: vector-append vec …

[SRFI-43] Returns a newly allocated vector whose contents are concatenation of elements of vec in order.

Function: vector-concatenate list-of-vectors

[SRFI-43] Acts like (apply vector-append list-of-vectors), though this may be more efficient.

ベクタ上の述語

Function: vector-empty? vec

[SRFI-43] Returns #t if vec's length is zero, and #f if vec's length is more than zero. Signals an error if vec is not a vector.

Function: vector= elt= vec …

[SRFI-43] Compares vecs element-wise, using given predicate elt=. Returns #t iff lengths of all the vectors are the same, and every corresponding elements are equal by elt=. Elt= is always called with two arguments and must return #t iff two are the same.

ベクタ上の反復

Function: vector-fold kons knil vec1 vec2 …

[SRFI-43] Kons is iterated over each corresponding elements of the given vectors, with passing around the seed value, whose default is proided by knil.

Function: vector-fold-right kons knil vec1 vec2 …

[SRFI-43]

Function: vector-map f vec1 vec2 …

[SRFI-43]

Function: vector-map! f vec1 vec2 …

[SRFI-43]

Function: vector-for-each f vec1 vec2 …

[SRFI-43]

Function: vector-count pred vec1 vec2 …

[SRFI-43]

ベクタ上の検索

Function: vector-index pred vec1 vec2 …
Function: vector-index-right pred vec1 vec2 …

[SRFI-43] Returns the index of the first or the last elements in vec1 vec2 … that satisfy pred, respectively. Returns #f if no elements satisfy pred. In vector-index, comparison ends at the end of the shortest vector. For vector-index-right, all the vectors must have the same length.

Function: vector-skip pred vec1 vec2 …
Function: vector-skip-right pred vec1 vec2 …

[SRFI-43] Like vector-index and vector-index-right, except that the result of pred is negated. That is, returns the index of the first or the last elements that don't sastisfy pred.

Function: vector-binary-search vec value cmp &optional start end

[SRFI-43+] Look for value in a vector vec, and returns its index if it is found, or #f if it is not found. Comparison of value and an element in vec is done by a procedure cmp, which takes two arguments, and should return a negative integer if the first argument is less than the second, 0 if they are the same, and a positive integer if the first is greater than tne second.

Elements in vec must be ordered from smaller to greater w.r.t. cmp. Using that fact, this procedure performs binary search instead of linear search.

The optional arguments start and end are an extention to SRFI-43, and can be used to limit the range of the search in start-th element (inclusive) to end-th element (exclusive).

Function: vector-any pred vec1 vec2 …

[SRFI-43] Applies pred on each corresponding elements of vec1 vec2 … left to right, and as soon as pred returns non-#f value, the procedure stops iteration and returns the value.

If no elements that satisfy pred are found, it returns #f.

Vectors can have different lengths. Iteration stops at the end of the shortest.

Function: vector-every pred vec1 vec2 …

[SRFI-43] Applies pred on each corresponding elements of vec1 vec2 … left to right. If all the elements (when the lengths of vectors differ, the first N elements where N is the length of the shortest) satisfy pred, returns the last result of pred. Otherwise returns #t.

ベクタの変更子

Function: vector-swap! vec i j

[SRFI-43] Swaps vector vec's i-th and j-th elements.

Function: vector-reverse! vec &optional start end

[SRFI-43]

Function: vector-copy! target tstart source &optional sstart send

[SRFI-43]

Function: vector-reverse-copy! target tstart source &optional sstart send

[SRFI-43]

ベクタの変換

Function: reverse-vector->list vec &optional start end

[SRFI-43]

Function: reverse-list->vector list &optional start end

[SRFI-43]


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Shiro Kawai on November, 22 2009 using texi2html 1.78.