Skip to content
This repository was archived by the owner on Jul 7, 2024. It is now read-only.
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

range :by is one too high? #33

@AkashaP

Description

@AkashaP

core/list/range

To me it makes sense if
> (range :from 1 :to 10) out = (1 2 3 4 5 6 7 8 9 10)

was a shorthand for
> (range :from 1 :to 10 :by 1)

but it is not, it is a shorthand for
> (range :from 1 :to 10 :by 2) out = (1 2 3 4 5 6 7 8 9 10)

In fact, running
> (range :from 1 :to 10 :by 1)
causes an infinite loop which could be guarded against. Since it cant be negative may as well guard against :by (n < 1) too.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions