Travis Griggs
10/20/2023, 4:41 PMsetOf(*(0..<15)) , but the spread operator doesn't like using a Range? (in my case, the range is programatically created, rather than a literal as shown there)Klitos Kyriacou
10/20/2023, 4:44 PMIntRange you can use range.toSet(). It doesn't work for an OpenEndRange<Int>Travis Griggs
10/20/2023, 4:51 PMShawn
10/20/2023, 4:51 PM(0..<15).toSet()
works just fineKlitos Kyriacou
10/20/2023, 4:52 PMOpenEndRange<T> contains a finite number of Ts. It does for Int, but that's just a special case. What would you say ("Alpha"..<"Zulu").toSet() should contain?
(0..<15).toSet() works fine because (0..<15) is an IntRange, which implements the OpenEndRange<Int> interface, but importantly it also implements Iterable.Travis Griggs
10/20/2023, 5:00 PMShawn
10/20/2023, 5:05 PMInt, like Travis asked, .toSet() works.