# \#unitrange

**URL:** https://discourse.julialang.org/tag/unitrange/1158.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Why is there no isless(::Int64, ::UnitRange{Int64})?](https://discourse.julialang.org/t/why-is-there-no-isless-int64-unitrange-int64/112648)

<div class="topic-metadata">

**Author:** [@mnemnion](https://discourse.julialang.org/u/mnemnion)\
**Replies:** 45\
**Last updated:** [April 9, 2025, 1:54am UTC](https://discourse.julialang.org/t/why-is-there-no-isless-int64-unitrange-int64/112648 "2025-04-09T01:54:22Z")

</div>

It seems to me that all of these are unambiguous: 1 \< 4:5 == true 2 ≤ 2:5 == true 3 ≤ 2:5 == true 5 ≤ 2:5 == true 6 ≤ 2:5 == false 6 \> 2:5 == true 4 \> 2:5 == false That is, for any Int, we can derive an unambiguous a…

---

## [The colon punctuation: Why doesn't 5:1 return \[5, 4, 3, 2, 1\]?](https://discourse.julialang.org/t/the-colon-punctuation-why-doesnt-5-1-return-5-4-3-2-1/107676)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 8\
**Last updated:** [December 16, 2023, 6:04pm UTC](https://discourse.julialang.org/t/the-colon-punctuation-why-doesnt-5-1-return-5-4-3-2-1/107676 "2023-12-16T18:04:19Z")

</div>

I got surprised by this: julia\> 1:5 # Expected 1:5 julia\> 5:1 # Unexpected 5:4 julia\> collect(1:5) # Expected 5-element Vector{Int64}: 1 2 3 4 5 julia\> collect(5:1) # Doubly Unexpected Int64\[\] julia\> collect(5:…

---

## [Iterate out of range](https://discourse.julialang.org/t/iterate-out-of-range/95360)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 3\
**Last updated:** [February 28, 2023, 10:50pm UTC](https://discourse.julialang.org/t/iterate-out-of-range/95360 "2023-02-28T22:50:35Z")

</div>

Are these results expected? julia\> iterate(3:7, 9) (10, 10) julia\> iterate(3:7, 9) (10, 10) julia\> iterate(3:1:7, 9) (10, 10) julia\> iterate('c':'l','n') ('o', 'o') julia\> iterate('c':'l',15) ('\\x10', '\\x10')

---

## [Any at UnitRange seems unoptimal](https://discourse.julialang.org/t/any-at-unitrange-seems-unoptimal/88650)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 20\
**Last updated:** [October 13, 2022, 4:17pm UTC](https://discourse.julialang.org/t/any-at-unitrange-seems-unoptimal/88650 "2022-10-13T16:17:01Z")

</div>

Hey Julianners! One of the most used struct UnitRange. I feel something is odd here. Why we have Any\[Core.Const(1), Int64\]? This sounds pretty unoptimal. using InteractiveUtils unitrange\_any(N) = begin c=1:N end uni…
