github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/mkarray/non-decimal.md (about)

     1  # Non-Decimal Ranges
     2  
     3  > Create arrays of integers from non-decimal number bases
     4  
     5  ## Description
     6  
     7  When making arrays you can specify ranges of an alternative number base by
     8  using an `x` or `.` in the end range:
     9  
    10  ```
    11  a [00..ffx16]
    12  a [00..ff.16]
    13  ```
    14  
    15  All number bases from 2 (binary) to 36 (0-9 plus a-z) are supported.
    16  Please note that the start and end range are written in the target base
    17  while the base identifier is written in decimal: `[hex..hex.dec]`
    18  
    19  Also note that the additional zeros denotes padding (ie the results will
    20  start at `00`, `01`, etc rather than `0`, `1`...)
    21  
    22  Please refer to [a (mkarray)](../commands/a.md) for more detailed usage of mkarray.
    23  
    24  ## Usage
    25  
    26  ```
    27  a: [start..end] -> <stdout>
    28  a: [start..end,start..end] -> <stdout>
    29  a: [start..end][start..end] -> <stdout>
    30  ```
    31  
    32  All usages also work with `ja` and `ta` as well, eg:
    33  
    34  ```
    35  ja: [start..end] -> <stdout>
    36  ta: data-type [start..end] -> <stdout>
    37  ```
    38  
    39  You can also inline arrays with the `%[]` syntax, eg:
    40  
    41  ```
    42  %[start..end]
    43  ```
    44  
    45  ## Examples
    46  
    47  ```
    48  » a [08..10x16]
    49  08
    50  09
    51  0a
    52  0b
    53  0c
    54  0d
    55  0e
    56  0f
    57  10
    58  ```
    59  
    60  ```
    61  » a [10..08x16]
    62  10
    63  f
    64  e
    65  d
    66  c
    67  b
    68  a
    69  9
    70  8
    71  ```
    72  
    73  ## Detail
    74  
    75  ### Floating Point Numbers
    76  
    77  If you do need a range of fixed floating point numbers generated then you can
    78  do so by merging two decimal integer ranges together. For example
    79  
    80  ```
    81  » a [05..10x8].[0..7]
    82  05.0
    83  05.1
    84  05.2
    85  05.3
    86  05.4
    87  05.5
    88  05.6
    89  05.7
    90  06.0
    91  06.1
    92  06.2
    93  ...
    94  07.5
    95  07.6
    96  07.7
    97  10.0
    98  10.1
    99  10.2
   100  10.3
   101  10.4
   102  10.5
   103  10.6
   104  10.7
   105  ```
   106  
   107  ### Everything Is A String
   108  
   109  Please note that all arrays are created as strings. Even when using typed
   110  arrays such as JSON (`ja`).
   111  
   112  ```
   113  » ja [0..5]
   114  [
   115      "0",
   116      "1",
   117      "2",
   118      "3",
   119      "4",
   120      "5"
   121  ] 
   122  ```
   123  
   124  ## See Also
   125  
   126  * [Character arrays](../mkarray/character.md):
   127    Making character arrays (a to z)
   128  * [Decimal Ranges](../mkarray/decimal.md):
   129    Create arrays of decimal integers
   130  * [`[ ..Range ]`](../parser/range.md):
   131    Outputs a ranged subset of data from STDIN
   132  * [`[[ Element ]]`](../parser/element.md):
   133    Outputs an element from a nested structure
   134  * [`a` (mkarray)](../commands/a.md):
   135    A sophisticated yet simple way to build an array or list
   136  * [`count`](../commands/count.md):
   137    Count items in a map, list or array
   138  * [`ja` (mkarray)](../commands/ja.md):
   139    A sophisticated yet simply way to build a JSON array
   140  * [`ta` (mkarray)](../commands/ta.md):
   141    A sophisticated yet simple way to build an array of a user defined data-type
   142  * [index](../parser/item-index.md):
   143    Outputs an element from an array, map or table
   144  
   145  <hr/>
   146  
   147  This document was generated from [builtins/core/mkarray/ranges_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/mkarray/ranges_doc.yaml).