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
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.
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.
Converts a Blob into a Disarray. It is always hydrated to its maximum depth.
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.
Returns the maximum depth of a Disarray. An empty array has depth one.
Returns true if the value is a valid Disarray.
Licensed under the MIT license. See LICENSE.md.
Copyright (c) 2018, zenoamaro (zenoamaro@gmail.com)