15 Aug 2012 02:26
Re: [felix] Mapping over tuples, varargs
On 15/08/2012, at 3:32 AM, Dobes Vandermeer wrote: > It's impossible in principle, theory, and practice. > > I can easily imagine a list of shapes. There I just did it. The universe did not implode. I can easily imagine my yacht can go 20 knots in a 1 knot breeze and I have a machine that makes electricity out of air. > If I have a program that calls for "a list of fruits and vegetables" I might construct that using a union type, but the final product is a heterogeneous list. No, it isn't, it's a homogenous list of type EdiblePlant. You have *unified* the various types into a single type. > Not really, you can use the default "_" case to catch everything that isn't relevant to the code at hand. The felix compiler does this a lot. And it''s a huge source of errors. I've been working to eliminate wildcard matches for this reason. Writing out all the cases is much better. The compiler then forces me to handle the new case everywhere it needs to be handled. About 50% of the time spent implementing the ** tuple stuff was going "Oh, I forgot to add a handler for that case in this function". Seriously! The problem was the relevant cases, like Unification algorithm, are considering a *relation*. Its a binary operation. So and exhaustive list of cases requires N^2 patterns. Easy enough if N=2 or 3. Not so good(Continue reading)
RSS Feed