enum MyIndex { case value(Int) case range(Range<Int>) case closedRange(ClosedRange<Int>) case partialRangeUpTo(PartialRangeUpTo<Int>) case partialRangeThrough(PartialRangeThrough<Int>) case unbound } prefix func + (x: Int) -> (MyIndex.Type) -> MyIndex { return { _ in .value(x) } } func ..< (x: Int, y: Int) -> (MyIndex.Type) -> MyIndex { return { _ in .range(x..<y) } } func ... (x: Int, y: Int) -> (MyIndex.Type) -> MyIndex { return { _ in .closedRange(x...y) } } prefix func ..< (x: Int) -> (MyIndex.Type) -> MyIndex { return { _ in .partialRangeUpTo(..<x) } } prefix func ... (x: Int) -> (MyIndex.Type) -> MyIndex { return { _ in .partialRangeThrough(...x) } } postfix func ... (_: MyIndex.Type) -> MyIndex { return .unbound } func foo(_ indices: (MyIndex.Type) -> MyIndex...) { print(indices.map { $0(MyIndex.self) }) } foo(..., 0..<12, +12)