This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see ContainerSrfiComparison in WG2's repo for R7RS-large.

Container­Srfi­Comparison

cowan
2012-12-18 07:06:25
7history
source

This is a face-to-face comparison of three container SRFIs, SRFI 1 for lists, SRFI 13 for strings, and SRFI 43 for vectors. It will eventually mature into a proposal to make them match up to some degree, as has been done in R7RS-small, but at the moment it's just data. Procedures present in the small language have mostly been removed unless they have corresponding procedures in other SRFIs that aren't part of the small language, as I assume that they won't be separately part of the large language. The order of functions is basically the order of SRFI-1, the most comprehensive library: the functions are grouped as constructors, predicates, selectors, miscellaneous, filtering, partitioning, searching, and deleting.

The following sections and subsections are omitted here because they aren't likely to have counterparts in other containers:

Function

List library

String library

Vector library

Specified elements plus existing container

cons*

-

-

Elements constructed by applying proc to integers

list-tabulate

string-tabulate

-

Elements are integers

iota

-

-

Copy container in reverse element order

-

-

vector-reverse-copy

Empty container predicate

null?

string-null?

vector-empty?

Elementwise equality

list=

-

vector=

Does one container subsume another?

-

string-contains(-ci)

-

Specified element

first .. tenth

-

-

Initial elements

take(!)

string-take

-

All but initial elements

drop

string-drop

-

Final elements

take-right(!)

string-take-right

-

All but final elements

drop-right

string-drop-right

-

Initial and final elements

split-at(!)

-

-

Last element

last

-

-

Inequality comparison

-

string(-ci)-<>

-

Comparison

-

string-compare(-ci)

-

Hashing

-

string-hash(-ci)

-

Prefix equality

-

string-prefix(-ci)?

-

Suffix equality

-

string-suffix(-ci)?

-

Shared prefix length

-

string-prefix-length(-ci)

-

Shared suffix length

-

string-suffix-length(-ci)

-

Concatenate containers in a list

concatenate(!)

string-concatenate

vector-concatenate

Concatenate with separator

-

string-join

-

Concatenate in reverse

-

string-concatenate-reverse

-

Reverse container

reverse(!)

string-reverse(!)

vector-reverse!

Append reversed container

append-reverse(!)

-

-

Swap elements

-

-

vector-swap!

Reverse conversion

-

reverse-list->string

-

Reverse conversion

-

reverse-vector->list

-

Reverse conversion

-

reverse-list->vector

-

Count of elements satisfying pred

count

string-countâ€

vector-count

Fundamental deconstructor

fold

string-fold

vector-fold

Fundamental deconstructor from right

fold-right

string-fold-right

vector-fold-right

Fundamental constructor

unfold

string-unfold

vector-unfold

Fundamental constructor from right

unfold-right

string-unfold-right

vector-unfold-right

Simplified constructor

reduce

-

-

Simplified constructor from right

reduce-right

-

-

Append results of mapping

append-map(!)

-

-

Linear-update map

map!

string-map!

vector-map!

Map saving only true values

filter-map

-

-

Map guaranteeing order

map-in-order

-

-

For-each with element and index

-

string-for-each-index

-

Replicated copy

-

xsubstring

-

Linear-update replicated copy

-

string-xcopy!

-

Container with elements matching pred

filter(!)

string-filterâ€

-

Two containers with elements matching and not

partition(!)

-

-

Container with elements not matching pred

remove(!)

string-deleteâ€

-

Find first element satisfying pred

find

-

-

Return true if any elements satisfy

any

string-anyâ€

vector-any

Return true if every element satisfies

every

string-everyâ€

vector-every

Index of first element satisfying pred

list-index

string-indexâ€

vector-index

Index of last element satisfying pred

-

string-index-rightâ€

vector-index-right

Find first element not satisfying pred

-

string-skipâ€

vector-skip

Find last element not satisfying pred

-

string-skip-rightâ€

vector-skip-right

Initial elements satisfying pred

take-while(!)

-

-

Final elements satisfying pred

drop-while

-

-

Initial elements satisfying pred plus final ones

span(!)

-

-

Initial elements not satisfying pred plus final ones

break(!)

-

-

Binary search

-

-

vector-binary-search

Remove elements by identity

delete(!)

string-deleteâ€

-

Remove duplicate elements

delete-duplicates(!)

-

-

List oddities

xcons, circular-list, proper-list?, circular-list?, dotted-list?, not-pair?, null-list?, car+cdr, last-pair, length/length+ (proposal: rename to simple-length/length), append!, pair-fold, pair-fold-right, pair-for-each, find-tail

String oddities

substring/shared, string-concatenate/shared, string-append/shared, string-concatenate-reverse/shared, string-replace, string-tokenize

Footnotes

†Polymorphic procedure: accepts character, character set, or predicate