You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generalize Ranges to support characters and other comparable values #647
Many other languages support the concept of a range that can be any sequence that meets simple criteria, beyond just integer sequences. I was looking to use a shorthand to create a list of characters from 'a' to 'z' but ranges only supports Integers, which means I needed to do
Generalizing ranges is something we're interested in, but not focused on currently. There's some design questions to sort out, like whether ranges will be restricted to Comparable values or whether they'll accept any value and include a corresponding Comparator object.
changed the title [-]Allow ranges for Char (and other types that support a generic increment and equality comparison)[/-][+]Generalize Ranges to support characters and other comparable types[/+]on Mar 28, 2025
changed the title [-]Generalize Ranges to support characters and other comparable types[/-][+]Generalize Ranges to support characters and other comparable values[/+]on Mar 28, 2025
Activity
jackfirth commentedon Mar 28, 2025
Generalizing ranges is something we're interested in, but not focused on currently. There's some design questions to sort out, like whether ranges will be restricted to
Comparablevalues or whether they'll accept any value and include a correspondingComparatorobject.[-]Allow ranges for Char (and other types that support a generic increment and equality comparison)[/-][+]Generalize Ranges to support characters and other comparable types[/+][-]Generalize Ranges to support characters and other comparable types[/-][+]Generalize Ranges to support characters and other comparable values[/+]usaoc commentedon Mar 28, 2025
start ..= endranges also work as sequences, so I’d writeThis is still sub-optimal, admittedly. Ideally,
(Char"a" ..= Char"z").to_list()should work just fine.