Skip to content

Instantly share code, notes, and snippets.

@moonmaster9000
Created April 10, 2010 22:12
Show Gist options
  • Save moonmaster9000/362331 to your computer and use it in GitHub Desktop.
Save moonmaster9000/362331 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 = leftPartition : slice n remainder
where
leftPartition = take n xs
remainder = drop n xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment