From c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Mon, 2 Mar 2015 10:55:22 +0100 Subject: Extend the docs for Data.List.transpose by giving a sufficient general example to explain what happens when the rows are not of the same lengths. Thanks to Doug McIlroy for the suggestoin. Fixes #10128. --- libraries/base/Data/OldList.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libraries') diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs index 137ce42150..7e79c347d4 100644 --- a/libraries/base/Data/OldList.hs +++ b/libraries/base/Data/OldList.hs @@ -468,6 +468,10 @@ intercalate xs xss = concat (intersperse xs xss) -- For example, -- -- > transpose [[1,2,3],[4,5,6]] == [[1,4],[2,5],[3,6]] +-- +-- If some of the rows are shorter than the following rows, their elements are skipped: +-- +-- > transpose [[10,11],[20],[],[30,31,32]] == [[10,20,30],[11,31],[32]] transpose :: [[a]] -> [[a]] transpose [] = [] -- cgit v1.2.1