From a365492f7e6230c55983aa2307238054c6196e5f Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 2 Apr 2021 16:38:44 -0400 Subject: [PATCH] Document missing functions --- docs/api/srfi/132.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/api/srfi/132.md b/docs/api/srfi/132.md index 07d8d1c3..f61cef80 100644 --- a/docs/api/srfi/132.md +++ b/docs/api/srfi/132.md @@ -15,8 +15,12 @@ See the [SRFI document](http://srfi.schemers.org/srfi-132/srfi-132.html) for mor - [`list-stable-sort`](#list-stable-sort) - [`vector-delete-neighbor-dups!`](#vector-delete-neighbor-dups-1) - [`vector-delete-neighbor-dups`](#vector-delete-neighbor-dups) +- [`vector-find-median`](#vector-find-median) +- [`vector-find-median!`](#vector-find-median-1) - [`vector-merge!`](#vector-merge-1) - [`vector-merge`](#vector-merge) +- [`vector-select!`](#vector-select-1) +- [`vector-separate!`](#vector-separate-1) - [`vector-sort!`](#vector-sort-1) - [`vector-sort`](#vector-sort) - [`vector-sorted?`](#vector-sorted) @@ -95,6 +99,18 @@ This procedure does not alter its input vector, but rather newly allocates and r This procedure reuses its input vector to hold the answer, packing it into the index range [start, newend), where newend is the non-negative exact integer that is returned as its value. The vector is not altered outside the range [start, newend). +# vector-find-median + + (vector-find-median < v knil [ mean ]) + +This procedure does not alter its input vector, but rather newly allocates a vector to hold the intermediate result. Runs in O(n) time. + +# vector-find-median! + + (vector-find-median! < v knil [ mean ]) + +This procedure reuses its input vector to hold the intermediate result, leaving it sorted, but is otherwise the same as vector-find-median. Runs in O(n ln n) time. + # vector-merge (vector-merge < v1 v2 [ start1 [ end1 [ start2 [ end2 ] ] ] ]) @@ -111,6 +127,18 @@ This procedure writes its result into vector `to`, beginning at index `start`, f All four merge operations are stable: an element of the initial list `lis1` or vector `v1` will come before an equal-comparing element in the second list `lis2` or vector `v2` in the result. +# vector-select! + + (vector-select! < v k [ start [ end ] ] ) + +This procedure returns the `k`th smallest element (in the sense of the `<` argument) of the region of a vector between `start` and `end`. Elements within the range may be reordered, whereas those outside the range are left alone. Runs in `O(n)` time. + +# vector-separate! + + (vector-separate! < v k [ start [ end ] ] ) + +This procedure places the smallest `k` elements (in the sense of the `<` argument) of the region of a vector between `start` and `end` into the first `k` positions of that range, and the remaining elements into the remaining positions. Otherwise, the elements are not in any particular order. Elements outside the range are left alone. Runs in `O(n)` time. Returns an unspecified value. + # vector-sort (vector-sort < v [ start [ end ] ])