((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/sparse-vectors" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg") (toc)) (section 2 "sparse-vectors" (section 3 "Introduction" (p "Sparse vectors are vectors that grow as large as they need to. That is, they can be indexed by arbitrarily large nonnegative integers. The implementation allows for arbitrarily large gaps by arranging the entries in a tree.")) (section 3 "Usage" (pre "(require-extension sparse-vectors)") (p "If you have the " (link "http://wiki.call-cc.org/eggref/4/numbers" "numbers") " extension installed then this extension will be built with an additional variant that supports bignum indices:") (pre "(require-extension big-sparse-vectors)")) (section 3 "API" (def (sig (procedure " (make-sparse-vector [DEFAULT])" (id make-sparse-vector)) (procedure " (sparse-vector? x)" (id sparse-vector?)) (procedure " (sparse-vector-ref sparse-vector k)" (id sparse-vector-ref)) (procedure " (sparse-vector-set! sparse-vector k value)" (id sparse-vector-set!)) (procedure " (sparse-vector->list sparse-vector)" (id sparse-vector->list))) (p (tt "make-sparse-vector") ", " (tt "sparse-vector-ref") " and " (tt "sparse-vector-set!") " are analogous to " (tt "make-vector") ", " (tt "vector-ref") " and " (tt "vector-set!") ", except that the indices passed to " (tt "sparse-vector-ref") " and " (tt "sparse-vector-set!") " can be arbitrarily large.") (p "The optional " (tt "DEFAULT") " argument to the " (tt "make-sparse-vector") " procedure specifies the default value for indices whose elements have not been set. If the element at index " (tt "i") " has not been set, " (tt "(sparse-vector-ref i)") " returns " (tt "DEFAULT") " or #f, if " (tt "DEFAULT") " was not specified when creating the vector.") (p (tt "sparse-vector->list") " is for debugging: It returns a list of the consecutive elements in a sparse vector from 0 to the highest element that has been set. Note that the list will also include all the #f elements for the unset elements.") (p (tt "(set! (sparse-vector-ref sparse-vector index) value)") " is supported."))) (section 3 "Authors" (p "Richard Kelsey and Jonathan Rees, ported to CHICKEN by " (int-link "/users/ivan-raikov") ".")) (section 3 "License" (pre "Copyright (c) 1993-2006 Richard Kelsey and Jonathan Rees\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n3. The name of the authors may not be used to endorse or promote products\n   derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")) (section 3 "Version history" (dl (dt "0.4") (dd "Fixed installation-script problems, added tests (thanks to Jim Pryor)") (dt "0.3") (dd "Ported to Chicken 4") (dt "0.2") (dd "Added functionality to support default values other than #f") (dt "0.1") (dd "Initial release")))))