Closed
Description
I have the following code:
module Main (main) where
import Data.Vector
import Data.Vector.Algorithms.Heap
go :: Vector Int -> Vector Int
go = modify $ \ v -> partialSort v 2
main :: IO ()
main = print $ go $ fromList [4, 3, 2, 1, 5]
The documentation of partialSort
says:
Moves the lowest k elements to the front of the array, sorted.
The remaining values of the array will be in no particular order.
From this, I would expect this to give me [1, 2, ...]
. However, I get [1, 3, 4, 5, 2]
.
Is this a bug or am I doing something wrong?
Metadata
Metadata
Assignees
Labels
No labels