On 05/28/2013 06:15 AM, David Snider wrote:
In standard ML you can write

fun zip _ _ = []
  | zip (a::as) (b::bs) = (a,b) :: (zip as bs)

What would be the Ur equivalent of this kind of pattern matching?

I'm assuming your code has a bug in the ordering of the patterns, which I fix below.

fun zip [t] (a : list t) (b : list t) : list (t * t) =
  case (a, b) of
      (a :: as, b :: bs) => (a, b) :: zip as bs
    | _ => []


_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to