Is there any way to create a finite set that can be used like an enum can to limit the amount of possible values for a case?
To be clear I know how to use enums here, what I’m looking for is any possible alternative, this is for science and additional methods rather than solving a specific issue so no need to offer solutions to this that involve what I’m trying to work around (may as well save people the time).
rank_int<public>:=type{_X:int where 0 <= _X, _X <= 18}
ToRank(RankInt:rank_int)<transacts>:rank_enum=
case(RankInt):
0 => rank_enum.Unranked
1 => rank_enum.Bronze1
2 => rank_enum.Bronze2
3 => rank_enum.Bronze3
4 => rank_enum.Silver1
5 => rank_enum.Silver2
6 => rank_enum.Silver3
7 => rank_enum.Gold1
8 => rank_enum.Gold2
9 => rank_enum.Gold3
10 => rank_enum.Platinum1
11 => rank_enum.Platinum2
12 => rank_enum.Platinum3
13 => rank_enum.Diamond1
14 => rank_enum.Diamond2
15 => rank_enum.Diamond3
16 => rank_enum.Elite
17 => rank_enum.Champion
18 => rank_enum.Unreal
# _ => rank_enum.Unranked <- This will be required here to handle all other ints, what i'm looking for is the ability to not have to include the 'else' case here, I would like a finite defined set
Any way to achieve this outside of using enums would be awesome to know about. Thanks.