-
Notifications
You must be signed in to change notification settings - Fork 0
Indexable Sequences for R6RS
License
dharmatech/indexable-sequence
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
About
Indexable Sequences for R6RS
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published