Add unfinS to util
This commit is contained in:
parent
ac93582e96
commit
5ad68cdb44
16
src/Util.md
16
src/Util.md
|
@ -11,6 +11,7 @@ import Data.String
|
|||
import Data.List.Lazy
|
||||
import Data.List1
|
||||
import Data.Vect
|
||||
import Data.Fin
|
||||
|
||||
%default total
|
||||
```
|
||||
|
@ -137,6 +138,21 @@ Lazily generate all the permutations of a Vect
|
|||
(y, z :: ys) :: map (consSnd y) (select (z :: ys))
|
||||
```
|
||||
|
||||
## Fin
|
||||
|
||||
```idris hide
|
||||
namespace Fin
|
||||
```
|
||||
|
||||
|
||||
```idris
|
||||
||| Decriment a Fin, wrapping on overflow
|
||||
export
|
||||
unfinS : {n : _} -> Fin n -> Fin n
|
||||
unfinS FZ = last
|
||||
unfinS (FS x) = weaken x
|
||||
```
|
||||
|
||||
## Vectors
|
||||
|
||||
Define some operations for pairs of numbers, treating them roughly like vectors
|
||||
|
|
Loading…
Reference in a new issue