Skip to content

Commit da7aa3b

Browse files
dlesnoffZoomRmc
andauthored
Use openArray in absMaxSort
Co-authored-by: Zoom <[email protected]>
1 parent e8e044b commit da7aa3b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

maths/abs.nim

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ func absMax(x: seq[int]): Natural {.raises: [ValueError].} =
3434
if absVal(x[i]) > result:
3535
result = absVal(x[i])
3636

37-
func absMaxSort(x: seq[int]): int {.raises: [ValueError].} =
37+
func absMaxSort(x: openArray[int]): int {.raises: [ValueError].} =
3838
## Returns the signed element whose absolute value is the largest in a sequence.
39-
var x: seq[int] = x
39+
var x: seq[int] = @x
4040
if x.len == 0:
4141
raise newException(ValueError, "Cannot find absolute maximum of an empty sequence")
4242
sort(x, proc (a, b: int): int = int(absVal(b)) - int(absVal(a)))

0 commit comments

Comments
 (0)