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

     1  # Decimal Ranges
     2  
     3  > Create arrays of decimal integers
     4  
     5  ## Description
     6  
     7  This document describes how to create arrays of decimals using mkarray (`a` et
     8  al).
     9  
    10  Please refer to [a (mkarray)](../commands/a.md) for more detailed usage of mkarray.
    11  
    12  ## Usage
    13  
    14  ```
    15  a: [start..end] -> <stdout>
    16  a: [start..end,start..end] -> <stdout>
    17  a: [start..end][start..end] -> <stdout>
    18  ```
    19  
    20  All usages also work with `ja` and `ta` as well, eg:
    21  
    22  ```
    23  ja: [start..end] -> <stdout>
    24  ta: data-type [start..end] -> <stdout>
    25  ```
    26  
    27  You can also inline arrays with the `%[]` syntax, eg:
    28  
    29  ```
    30  %[start..end]
    31  ```
    32  
    33  ## Examples
    34  
    35  ```
    36  » a [1..3]
    37  1
    38  2
    39  3
    40  ```
    41  
    42  ```
    43  » a [3..1]
    44  3
    45  2
    46  1
    47  ```
    48  
    49  ```
    50  » a [01..03]
    51  01
    52  02
    53  03
    54  ```
    55  
    56  ## Detail
    57  
    58  ### Floating Point Numbers
    59  
    60  If you do need a range of fixed floating point numbers generated then you can
    61  do so by merging two decimal integer ranges together. For example
    62  
    63  ```
    64  » a [0..5].[0..9]
    65  0.0
    66  0.1
    67  0.2
    68  0.3
    69  0.4
    70  0.5
    71  0.6
    72  0.7
    73  0.8
    74  0.9
    75  1.0
    76  1.1
    77  1.2
    78  1.3
    79  ...
    80  4.8
    81  4.9
    82  5.0
    83  5.1
    84  5.2
    85  5.3
    86  5.4
    87  5.5
    88  5.6
    89  5.7
    90  5.8
    91  5.9
    92  ```
    93  
    94  ### Everything Is A String
    95  
    96  Please note that all arrays are created as strings. Even when using typed
    97  arrays such as JSON (`ja`).
    98  
    99  ```
   100  » ja [0..5]
   101  [
   102      "0",
   103      "1",
   104      "2",
   105      "3",
   106      "4",
   107      "5"
   108  ] 
   109  ```
   110  
   111  ## See Also
   112  
   113  * [Character arrays](../mkarray/character.md):
   114    Making character arrays (a to z)
   115  * [Non-Decimal Ranges](../mkarray/non-decimal.md):
   116    Create arrays of integers from non-decimal number bases
   117  * [`[ ..Range ]`](../parser/range.md):
   118    Outputs a ranged subset of data from STDIN
   119  * [`[[ Element ]]`](../parser/element.md):
   120    Outputs an element from a nested structure
   121  * [`a` (mkarray)](../commands/a.md):
   122    A sophisticated yet simple way to build an array or list
   123  * [`count`](../commands/count.md):
   124    Count items in a map, list or array
   125  * [`ja` (mkarray)](../commands/ja.md):
   126    A sophisticated yet simply way to build a JSON array
   127  * [`ta` (mkarray)](../commands/ta.md):
   128    A sophisticated yet simple way to build an array of a user defined data-type
   129  * [index](../parser/item-index.md):
   130    Outputs an element from an array, map or table
   131  
   132  <hr/>
   133  
   134  This document was generated from [builtins/core/mkarray/ranges_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/mkarray/ranges_doc.yaml).