
2 Oct
2011
2 Oct
'11
1:04 p.m.
--I tried to write such polymorphic function: expand (x,y,z) = (x,y,z) expand (x,y) = (x,y,1) --And it didn't compile. Then I added a type signature: expand::a->b expand (x,y,z) = (x,y,z) expand (x,y) = (x,y,1) --It still didn't compile. I think the reason is that the following is disallowed: f::a->b f x = x --Is it possible to get around this and write the "expand" function? Of course, x and y may be of different types