Created
April 5, 2016 14:37
-
-
Save maiermic/c669bcf7cfe9a9e10450e47f0d6802f4 to your computer and use it in GitHub Desktop.
reverse Data.HVect in Idris
This file contains hidden or 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
| module reverse_hvect | |
| import Data.Vect | |
| import Data.HVect | |
| myReverse : Vect n a -> Vect n a | |
| myReverse [] = [] | |
| myReverse {n = S k} (x::xs) = rewrite plusCommutative 1 k in (myReverse xs) ++ [x] | |
| reverse : HVect ts -> HVect (myReverse ts) | |
| reverse [] = [] | |
| reverse (x::xs) = (reverse xs) ++ [x] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I try to reverse a
Data.HVectbut my code results in an error: