[Haskell-cafe] Re: howto tuple fold to do n-ary cross product?
miguelimo38 at yandex.ru
Sun Nov 30 13:06:31 EST 2008
Tuples would still be distinguishable from lists, since "cons" changes
their type: (b,c,d) and (a,b,c,d) would have different types, while
[b,c,d] and [a,b,c,d] wouldn't.
On 30 Nov 2008, at 20:48, Brandon S. Allbery KF8NH wrote:
> On 2008 Nov 30, at 12:43, Max Rabkin wrote:
>> On Sun, Nov 30, 2008 at 9:30 AM, Luke Palmer <lrpalmer at gmail.com>
>>> cross :: [a] -> [b] -> [(a,b)]
>>> It's just kind of a pain (you build [(a,(b,(c,d)))] and then
>>> out the tuples). The applicative notation is a neat little trick
>>> which does this work for you.
>> It seems to me like this would all be easy if (a,b,c,d) was sugar for
>> (a,(b,(c,d))), and I can't see a disadvantage to that.
> No disadvantage aside from it making tuples indistinguishable from
> brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe