indexable-sequence
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Indexable Sequences for R6RS
An indexable sequence is one which supports the following operations:

    size seq       Get the length
    ref  i         Get the element at i
    put! i val     Set the element at i
    new-of-size n  Make a new sequence of size n

'define-indexable-sequence-operations', when given these procedures
for a particular data type, will generate the following procedures and macros:

    fold-left  proc val seq ...		MACRO
    fold-right proc val seq ...		MACRO
    for-each   proc seq ...		MACRO
    for-each-with-index proc seq ...	MACRO
    copy seq
    map! proc seq
    map  proc seq ...			MACRO
    subseq seq start end
    take seq n
    drop seq n
    filter-to-reverse-list seq proc
    filter seq proc
    index seq proc
    find seq proc
    swap! seq i j
    reverse! seq
    reverse seq

The operations are defined using names based on the data type. For
example, the following expression:

    (define-indexable-sequence-operations
      vector
      vector-length
      vector-ref
      vector-set!
      make-vector)

will generate the following:

    vector-fold-left
    vector-fold-right
    vector-for-each
    vector-for-each-with-index
    vector-copy
    vector-map!
    vector-map
    vector-subseq
    vector-take
    vector-drop
    vector-filter-to-reverse-list
    vector-filter
    vector-index
    vector-find
    vector-swap!
    vector-reverse!
    vector-reverse

Libraries are provided for the following data types:

    vector
    string
    f64-vector  (based on R6RS bytevectors)
    f32-vector  (based on R6RS bytevectors)

SETUP

    $ cd ~/scheme # Where '~/scheme' is the path to your Scheme libraries
    $ git clone git://github.com/dharmatech/indexable-sequence.git

To run the tests:

    $ scheme --script ~/scheme/indexable-sequence/test-vector.sps

The tests pass in Chez, Ikarus, Ypsilon, and Mosh.

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。