Created
November 14, 2012 14:58
-
-
Save evrim/4072586 to your computer and use it in GitHub Desktop.
applicative linear algebra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vectorSpace ∷ (Enum a1, Eq a, Num a1, Num a, Ord a1) ⇒ a1 → a → [[a1]] | |
vectorSpace q 0 = [[]] | |
vectorSpace q n | q > 0 = (:) <$> [0..q-1] <*> (vectorSpace q $ n - 1) | |
vectorSpace _ _ = error "vectorSpace" | |
*Main Numeric.LinearAlgebra> length $ vectorSpace 2 (2^3) | |
256 | |
*Main Numeric.LinearAlgebra> length $ vectorSpace 2 (2^4) | |
65536 | |
*Main Numeric.LinearAlgebra> length $ vectorSpace 2 (2^5) | |
Process haskell killed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
*Main Numeric.LinearAlgebra> length $ vectorSpace 2 (2^5)
Process haskell killed