Clojure

Add a variant of range that's inclusive with respect to its upper boundary

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: Release 1.6
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Such a variant of range might behave like this:

```
(irange 1 5)
;;=> (1 2 3 4 5)

(irange 1 2 5)
;;=> (1 3 5)
```

I'm suggesting this because often in practice we have to deal with inclusive ranges and having to add 1 to the upper boundary in such scenarios seems to reduce the clarity of the code. I guess something like this applies to some extend to lower boundary as well:

```
(erange 1 5)
;;=> (2 3 4)
```

Activity

Hide
Alex Miller added a comment -

We're not interested in adding these to core, thanks.

Show
Alex Miller added a comment - We're not interested in adding these to core, thanks.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: