Skip to content

Instantly share code, notes, and snippets.

@moonmaster9000
Created April 10, 2010 22:13
Show Gist options
  • Save moonmaster9000/362332 to your computer and use it in GitHub Desktop.
Save moonmaster9000/362332 to your computer and use it in GitHub Desktop.
module LiquidLayouts (columnSort) where
import List
columnSort xs n = concat (transpose (slice sliceSize xs))
where
sliceSize =
ceiling (fromIntegral(length xs) / fromIntegral(n))
slice _ [] = []
slice n xs = firstSlice : remainingSlices
where
firstSlice = take n xs
remainingSlices = slice n (drop n xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment