[Ur] Pattern Matching
Adam Chlipala
adamc at csail.mit.edu
Tue May 28 09:26:36 EDT 2013
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
| _ => []
More information about the Ur
mailing list