From 8b796763a37a41be107b1f4aae50b28a56a3cdb9 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 9 Jul 2014 18:54:05 +0200 Subject: [PATCH] Fix to included last element in reversed --- lib/pure/algorithm.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index 7af1b2ad86..89c83a8a43 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -36,10 +36,10 @@ proc reverse*[T](a: var openArray[T]) = proc reversed*[T](a: openArray[T], first, last: int): seq[T] = ## returns the reverse of the array `a[first..last]`. - result = newSeq[T](last - first) + result = newSeq[T](last - first + 1) var x = first var y = last - while x < last: + while x <= last: result[x] = a[y] dec(y) inc(x)