Skip to content

types/basic_types/range: simpler way to convert a range into a list #2083

@CAESIUS-TIM

Description

@CAESIUS-TIM

1. Conversion - A range may be converted to a `list` using:
```nu
1..5 | each {||}
```

1..3 | each {}
# ╭───┬───╮
# │ 0 │ 1 │
# │ 1 │ 2 │
# │ 2 │ 3 │
# ╰───┴───╯

1..3 | each {} | describe
# list<int> (stream)
version: 0.108.0
╭──────────────────────┬─────────────────────────────────────────────────╮
│ version0.108.0                                         │
│ major                │ 0                                               │
│ minor                │ 108                                             │
│ patch                │ 0                                               │
│ branch               │ makepkg                                         │
│ commit_hash          │ da141be11b3acaa55b39321e5f9651d02aa2ed6f        │
│ build_os             │ linux-x86_64                                    │
│ build_target         │ x86_64-unknown-linux-gnu                        │
│ rust_version         │ rustc 1.90.0 (1159e78c4 2025-09-14) (Arch Linux │
│                      │  rust 1:1.90.0-3)                               │
│ cargo_version        │ cargo 1.90.0 (840b83a10 2025-07-30) (Arch Linux │
│                      │  rust 1:1.90.0-3)                               │
│ build_time           │ 2025-10-15 21:35:02 +00:00                      │
│ build_rust_channel   │ release                                         │
│ allocator            │ standard                                        │
│ features             │ default, network, plugin, rustls-tls, sqlite,   │
│                      │ trash-support                                   │
│ installed_plugins    │                                                 │
│ experimental_options │ example=false, reorder-cell-paths=true,         │
│                      │ pipefail=false,                                 │
│                      │ enforce-runtime-annotations=false               │
╰──────────────────────┴─────────────────────────────────────────────────╯

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions