Skip to content

Instantly share code, notes, and snippets.

@sellout
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sellout/11299585 to your computer and use it in GitHub Desktop.
Save sellout/11299585 to your computer and use it in GitHub Desktop.
partition : Bits (m * n) -> Vect m (Bits n)
partition {m=Z} _ = Prelude.Vect.Nil
partition {m=S m} {n=n} bits =
truncate (replace (plusCommutative n (m*n)) bits)
:: partition (truncate (shiftRightLogical (cast n) bits))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment