Skip to content

Instantly share code, notes, and snippets.

@justjoheinz
Created October 22, 2015 18:57
Show Gist options
  • Save justjoheinz/751da5e936cef86ef587 to your computer and use it in GitHub Desktop.
Save justjoheinz/751da5e936cef86ef587 to your computer and use it in GitHub Desktop.
Zippy.idr
module Sandbox
import Data.Vect
||| zip to Vectors of the same size
||| using a proof that n=m
||| instead of zippy: Vect n e -> Vect n a -> Vect n (e,a)
zippy : Vect n e -> Vect m a -> (n = m)-> Vect m (e,a)
zippy [] [] Refl = []
zippy (x :: xs) (y :: ys) Refl = (x, y) :: zippy xs ys Refl
-- sample
e : Vect 3 String
e = ["Hello", "World", "Idris"]
a : Vect 3 Integer
a = [0,1,2]
result : Vect 3 (String, Integer)
result = zippy e a Refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment