Skip to content

Commit

Permalink
🐛 docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfram77 committed May 9, 2023
1 parent a420cf0 commit 275a108
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 47 deletions.
66 changes: 28 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,30 @@ An [array] is a collection of values, stored contiguously.<br>
📰 [Docs](https://nodef.github.io/extra-array/),
📘 [Wiki](https://github.com/nodef/extra-array/wiki/).

This package includes common array functions related to querying **about**
arrays, **generating** them, **comparing** one with another, finding their
**length**, **getting** and **setting** elements, obtaining its **properties**,
getting a **part** of it, **rearranging** elements in it, **finding** an element
of a subset of elements in it, performing **functional** operations,
**manipulating** it in various ways, **combining** together arrays or its
elements, of performing **set operations** upon it.
This package includes comprehensive set of array functions for **generating** an
array, **cloning** them, querying **about** them, getting non-negative
**indices**, managing its **length**, **getting/setting** elements, fully or
partially **sorting** them, obtaining **minimum(s)/maximum(s)**, **comparing**
one with another, getting a **part** of it, **searching a value**, obtaining all
possible **arrangements** or **random arrangements**, **finding** an element,
**taking/dropping** elements or **scanning** from the begining or end the of an
array, **searching** the index of a part of the array, performing **functional**
operations, **flattening** multi-level arrays, obtaining **prefix sum**,
**manipulating** it in various ways, **counting/partitioning** elements,
**splitting** it, **concatenating/joining** multiple arrays, **rearranging**
elements withing it, or performing **set operations** upon it. You can use our
package in a variety of ways to streamline your development process and simplify
the implementation of complex algorithms.

All functions except `from*()` take array as 1st parameter. Methods like
`swap()` are pure and do not modify the array itself, while methods like
`swap$()` *do modify (update)* the array itself. Some methods accept a map
function for *faster comparision* (like [unique]). I find the map-approach
beautiful, which I learned from Haskell's `sortOn()`. You can notice that I have
followed Javascript naming scheme as far as possible. Some names are borrowed
from Haskell, Python, Java, Processing.
We use a consistent naming scheme that helps you quickly identify the functions
you need. All functions except `from*()` take array as 1st parameter. Some
functions operate on a specified range in the array, and are called `ranged*()`.
Functions like `swap()` are pure and do not modify the array itself, while
functions like `swap$()` *do modify (update)* the array itself. Some functions
accept a map function for *faster comparision*, such as `unique()`. Furher,
functions which return an iterable instead of an array are prefixed with `i`,
such as `isubsequences()`. We borrow some names from other programming languages
such as *Haskell*, *Python*, *Java*, and *Processing*.

This package is available in *Node.js* and *Web* formats. To use it on the web,
simply use the `extra_array` global variable after loading with a `<script>`
Expand Down Expand Up @@ -63,7 +72,12 @@ xarray.permutations([1, 2, 3]);
```

<br>

![](https://i.imgur.com/46wYtxW.png)

<br>
<br>



## Index
Expand All @@ -83,9 +97,6 @@ xarray.permutations([1, 2, 3]);
| [keys] | Obtain all indices. |
| [values] | Get all values. |
| [entries] | Obtain all index-value pairs. |
| [ikeys] | List all indices. |
| [ivalues] | List all values. |
| [ientries] | List all index-value pairs. |
| | |
| [index] | Get zero-based index for an element in array. |
| [indexRange] | Get zero-based index range for part of array. |
Expand Down Expand Up @@ -115,12 +126,8 @@ xarray.permutations([1, 2, 3]);
| [searchUnsortedValue] | Find first index of an unsorted value. |
| [sort] | Arrange values in order. |
| [sort$] | Arrange values in order! |
| [sortRange] | Arrange a range of values in order. |
| [sortRange$] | Arrange a range of values in order! |
| [partialSort] | Partially arrange values in order. |
| [partialSort$] | Partially arrange values in order! |
| [partialSortRange] | Partially arrange a range of values in order. |
| [partialSortRange$] | Partially arrange a range of values in order! |
| | |
| [minimum] | Find first smallest value. |
| [minimumEntry] | Find first smallest entry. |
Expand Down Expand Up @@ -166,11 +173,6 @@ xarray.permutations([1, 2, 3]);
| [infixes] | Obtain all possible infixes. |
| [subsequences] | Obtain all possible subsequences. |
| [permutations] | Obtain all possible permutations. |
| [iprefixes] | List all possible prefixes. |
| [isuffixes] | List all possible suffixes. |
| [iinfixes] | List all possible infixes. |
| [isubsequences] | List all possible subsequences. |
| [ipermutations] | List all possible permutations. |
| [searchInfix] | Find first index of an infix. |
| [searchInfixRight] | Find last index of an infix. |
| [searchInfixAll] | Find indices of an infix. |
Expand Down Expand Up @@ -325,9 +327,6 @@ xarray.permutations([1, 2, 3]);
[keys]: https://github.com/nodef/extra-array/wiki/keys
[values]: https://github.com/nodef/extra-array/wiki/values
[entries]: https://github.com/nodef/extra-array/wiki/entries
[ikeys]: https://github.com/nodef/extra-array/wiki/ikeys
[ivalues]: https://github.com/nodef/extra-array/wiki/ivalues
[ientries]: https://github.com/nodef/extra-array/wiki/ientries
[index]: https://github.com/nodef/extra-array/wiki/index
[indexRange]: https://github.com/nodef/extra-array/wiki/indexRange
[isEmpty]: https://github.com/nodef/extra-array/wiki/isEmpty
Expand All @@ -353,12 +352,8 @@ xarray.permutations([1, 2, 3]);
[searchUnsortedValue]: https://github.com/nodef/extra-array/wiki/searchUnsortedValue
[sort]: https://github.com/nodef/extra-array/wiki/sort
[sort$]: https://github.com/nodef/extra-array/wiki/sort$
[sortRange]: https://github.com/nodef/extra-array/wiki/sortRange
[sortRange$]: https://github.com/nodef/extra-array/wiki/sortRange$
[partialSort]: https://github.com/nodef/extra-array/wiki/partialSort
[partialSort$]: https://github.com/nodef/extra-array/wiki/partialSort$
[partialSortRange]: https://github.com/nodef/extra-array/wiki/partialSortRange
[partialSortRange$]: https://github.com/nodef/extra-array/wiki/partialSortRange$
[minimum]: https://github.com/nodef/extra-array/wiki/minimum
[minimumEntry]: https://github.com/nodef/extra-array/wiki/minimumEntry
[maximum]: https://github.com/nodef/extra-array/wiki/maximum
Expand Down Expand Up @@ -399,11 +394,6 @@ xarray.permutations([1, 2, 3]);
[infixes]: https://github.com/nodef/extra-array/wiki/infixes
[subsequences]: https://github.com/nodef/extra-array/wiki/subsequences
[permutations]: https://github.com/nodef/extra-array/wiki/permutations
[iprefixes]: https://github.com/nodef/extra-array/wiki/iprefixes
[isuffixes]: https://github.com/nodef/extra-array/wiki/isuffixes
[iinfixes]: https://github.com/nodef/extra-array/wiki/iinfixes
[isubsequences]: https://github.com/nodef/extra-array/wiki/isubsequences
[ipermutations]: https://github.com/nodef/extra-array/wiki/ipermutations
[searchInfix]: https://github.com/nodef/extra-array/wiki/searchInfix
[searchInfixRight]: https://github.com/nodef/extra-array/wiki/searchInfixRight
[searchInfixAll]: https://github.com/nodef/extra-array/wiki/searchInfixAll
Expand Down
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ PARSE, OTHERS

INDEX -VE
- moveWithin


SOURCEMAP, UNIQUE DEPENDENCIES
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extra-array",
"version": "4.1.1",
"version": "4.1.2",
"description": "An array is a collection of values, stored contiguously.",
"main": "index.js",
"module": "index.mjs",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,7 @@ export function findRight<T>(x: T[], ft: TestFunction<T>): T {




// #region TAKE/DROP
// -----------------

Expand Down

0 comments on commit 275a108

Please sign in to comment.