Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zenoamaro/disarray
Arrays as the only data type
https://github.com/zenoamaro/disarray
array esolang esoteric
Last synced: 29 days ago
JSON representation
Arrays as the only data type
- Host: GitHub
- URL: https://github.com/zenoamaro/disarray
- Owner: zenoamaro
- License: mit
- Created: 2018-08-23T21:01:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T21:04:25.000Z (over 6 years ago)
- Last Synced: 2024-11-05T15:47:36.597Z (3 months ago)
- Topics: array, esolang, esoteric
- Language: TypeScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Disarray
Disarray is an esoteric language with only one data type: arrays.
~~~
[] → 0
[[]] → [0] → 1
[[] [[]]] → [0 [0]] → [0 1] → 2
[[] [[]] [[[], []]]] → [0 [0] [[0 0]]] → [0 1 [2]] → [0 1 1] → 3
~~~## API
#### type Blob → number | Blob[]
A Blob is either a number, or an array of Blobs. A number has a depth of zero; an array of numbers has depth 1, and so on.
#### type Disarray → [] | Disarray[]
A Blob is either an empty array, or an array of Disarrays. An empty array has a depth of one; an array of empty arrays has a depth of two, and so on.
#### hydrate(blob: Blob) → Disarray
Converts a Blob into a Disarray. It is always hydrated to its maximum depth.
#### dehydrate(dis: Disarray, depth: number = 0) → Blob
Converts a Disarray into a Blob at a certain depth. A depth of zero produces a single number; a depth of one produces an array of numbers, and so on. The number will be the length of that Disarray.
#### depth(dis: Disarray) → number
Returns the maximum depth of a Disarray. An empty array has depth one.
#### valid(dis: Disarray) → boolean
Returns true if the value is a valid Disarray.
## License
Licensed under the MIT license. See [LICENSE.md](LICENSE.md).
Copyright (c) 2018, zenoamaro ()