Skip to content

Incorrect behavior of step value in range #635

Closed
@Weathercold

Description

@Weathercold

version

[ Please specify which version of squint you're using. You can find this in package.json under "squint-cljs" ]

v0.8.134

problem

[ Please provide a short and to the point description of the problem ]

Unlike clojure,

  1. Negative step returns an empty iterable instead of iterating in reverse
  2. A step of 0 is the same as 1 instead of returning an infinite sequence of start

repro

[ Please provide a minimal and complete reproduction of the problem, preferably something which can be run with Node.js without dependencies. ]

user=> (doall (range 4 -1 -1))
[]
user=> (doall (take 5 (range 5 6 0)))
[ 5 ]

expected behavior

[ What is the behavior you expected to see from squint? ]

user=> (doall (range 4 -1 -1))
[ 4, 3, 2, 1, 0 ]
user=> (doall (take 5 (range 5 6 0)))                                                           
[ 5, 5, 5, 5, 5 ]

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