In this code: proc findMaxCrossingSubArray[T](arr: seq[T]; lo, mid, hi: int64): SliceResult[T] = var leftSum = T.min # ... Run
I want leftSum to be the minimum value of the type T. The compiler complains: Error: type mismatch: got <type int> but expected one of: proc min(x, y: int): int first type mismatch at position: 1 required type for x: int but expression 'T' is of type: type int proc min(x, y: int64): int64 first type mismatch at position: 1 required type for x: int64 but expression 'T' is of type: type int proc min(x, y: float32): float32 first type mismatch at position: 1 required type for x: float32 but expression 'T' is of type: type int proc min[T: not SomeFloat](x, y: T): T first type mismatch at position: 1 required type for x: T: not SomeFloat but expression 'T' is of type: type int proc min(x, y: int8): int8 first type mismatch at position: 1 required type for x: int8 but expression 'T' is of type: type int proc min(x, y: int16): int16 first type mismatch at position: 1 required type for x: int16 but expression 'T' is of type: type int proc min(x, y: int32): int32 first type mismatch at position: 1 required type for x: int32 but expression 'T' is of type: type int proc min[T](x: openArray[T]): T first type mismatch at position: 1 required type for x: openArray[T] but expression 'T' is of type: type int proc min(x, y: float64): float64 first type mismatch at position: 1 required type for x: float64 but expression 'T' is of type: type int Run