We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e8e044b commit da7aa3bCopy full SHA for da7aa3b
maths/abs.nim
@@ -34,9 +34,9 @@ func absMax(x: seq[int]): Natural {.raises: [ValueError].} =
34
if absVal(x[i]) > result:
35
result = absVal(x[i])
36
37
-func absMaxSort(x: seq[int]): int {.raises: [ValueError].} =
+func absMaxSort(x: openArray[int]): int {.raises: [ValueError].} =
38
## Returns the signed element whose absolute value is the largest in a sequence.
39
- var x: seq[int] = x
+ var x: seq[int] = @x
40
if x.len == 0:
41
raise newException(ValueError, "Cannot find absolute maximum of an empty sequence")
42
sort(x, proc (a, b: int): int = int(absVal(b)) - int(absVal(a)))
0 commit comments