sequences utils

  1. sequences utils
  2. Documentation
    1. Types
      1. sequence
      2. binary-predicate
    2. Usage
    3. ->list
    4. ->vector
    5. ->string
    6. histogram
    7. unfold->alist
    8. merge!
    9. merge
    10. sorted?
    11. sort!
    12. sort
  3. Requirements
  4. Authors
  5. Repository
  6. Version history
  7. License

(MoreO perations over generic or user-defined sequences.

Documentation

Types

sequence

binary-predicate

[type] sequence : (or string vector list ...)
[type] binary-predicate : ('a 'a --> boolean)

Note a sequence as understood by the sequences egg.

Usage

(import (sequences utils))
  ;but suggest
(import (prefix (sequences utils) seq:))

->list

->vector

->string

[procedure] (->list SEQ) --> vector
[procedure] (->vector SEQ) --> vector
[procedure] (->string SEQ) --> string

Coerce SEQ to the named sequence type, unless an instance.

SEQ
sequence ; sequence to coerce.

histogram

[procedure] (histogram SEQ [=?]) --> alist

Returns an (list-of ('a . integer)) where SEQ is (sequence-of 'a).

SEQ
sequence ; sequence to count element by element.
=?
binary-predicate ; equality predicate, default is equal?.

unfold->alist

[procedure] (unfold->alist SEQ NEXT SEED [=?]) --> alist
SEQ
sequence ; sequence to unfold.
NEXT
(KEY 'a -> 'a) ; next for KEY & previous, or initial, value.
SEED
'a ; initial value.
=?
binary-predicate ; equality predicate, default is equal?.

merge!

[procedure] (merge! SEQ-A SEQ-B <?) -> sequence
SEQ-A SEQ-B
sequence sequence ; sequences to merge.
<?
binary-predicate ; less-than predicate.

Return sequence is coerced to the same type as SEQA.

merge

[procedure] (merge SEQ-A SEQ-B <?) --> sequence
SEQ-A SEQ-B
sequence sequence ; sequences to merge.
<?
binary-predicate ; less-than predicate.

Return sequence is coerced to the same type as SEQA.

sorted?

[procedure] (sorted? SEQ <?) --> boolean
SEQ
sequence ; sequence to test.
<?
binary-predicate ; less-than predicate.

sort!

[procedure] (sort! SEQ <?) -> sequence
SEQ
sequence ; sequence to sort.
<?
binary-predicate ; less-than predicate.

Return sequence is coerced to the same type as SEQ.

sort

[procedure] (sort SEQ <?) --> sequence
SEQ
sequence ; sequence to sort.
<?
binary-predicate ; less-than predicate.

Return sequence is coerced to the same type as SEQ.

Requirements

srfi-1 sequences

Authors

Kon Lovett

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/sequences-utils

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

Version history

0.1.0
C5 release. Originally seq-utils from micro-stats.

License

Copyright (c) 2022, Kon Lovett
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
   derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.