This is a 'proof-of-concept' project for Abstract Data Types in JavaScript. This library describes the abstract data type, Sequence, and functions that act on this new abstract type.
A Sequence is an abstract data type defined by the operations that may be performed on it. To be a Sequence, a data collection must be able to be acted upon by the following three functions:
first returns the first element of the sequence
rest returns the same sequence back without the first element
cons takes two elements and makes a sequence of them
Of the major data structures in ES2015: Object, Array, Set and Map, all
but Object are supported. Therefore, any non-Object data structure in
JavaScript can be said to be also of abstract type Sequence. Any function in
this library can act upon any Array, Set or Map that you pass it.
If you want to play around with this, ensure you have Node v.4 or higher, as all the functions were written with ES2015 features.
This project was inspired by the "Core Functions" chapter in Clojure for the Brave and True by Daniel Higginbotham. The examples of sequence nodes (with examples in JS) were particularly helpful.