     
     func sum<T: NumericType>(ints: myList<T>) -> T {
         
-        switch self {
+        switch ints {
         case .Nil:
             return T(0)
             
-        case .Cons(head: let a, tail: let b):
-            return a + sum(ints: b) as! T
-            
-        default:
-            return T(0)
+        case let .Cons(x, xs):
+            return x + sum(ints: xs) 
         }
     }
     
     func product<T: NumericType>(ds: myList<T>) -> T {
         
-        switch self {
+        switch ds {
         case .Nil:
             return T(1.0)
             
-        case .Cons(head: let a, tail: let b):
-            return a * product(ds: b) as! T
-            
-        default:
-            return T(1.0)
+        case let .Cons(x, xs):
+            return x * product(ds: xs)
         }
     }
     

    }
}





indirect enum myList <A: NumericType> {
    case Nil
    case Cons(A, myList<A>)
}


