Differences between some constructs

1999-07-11 Thread Marcin 'Qrczak' Kowalczyk
1. Is there any difference between \a b -> (a, b) and let f a b = (a, b) in f ? 2. Is there any difference between case x of (a, b) -> (b, a) and let (a, b) = x in (b, a) ? -- __("

Re: Differences between some constructs

1999-07-11 Thread Lennart Augustsson
Marcin 'Qrczak' Kowalczyk wrote: > 1. Is there any difference between > \a b -> (a, b) > and > let f a b = (a, b) in f > ? No > > > 2. Is there any difference between > case x of (a, b) -> (b, a) > and > let (a, b) = x in (b, a) > ? Yes, if x is bottom. -- Lennart

Re: Deriving Enum

1999-07-11 Thread Wolfram Kahl
Koen Claessen <[EMAIL PROTECTED]> proposes the following diagonalisation function: > > [ (a,b) | (a,b) <- [1..] // [1..] ] > > For a suitable definition of (//), for example: > > (//) :: [a] -> [b] -> [(a,b)] > xs // ys = diagonalize 1 [[(x,y) | x <- xs] | y <- ys] >where >

Re: Deriving Enum

1999-07-11 Thread Koen Claessen
Fergus Henderson wrote: | Yes, the correct Haskell syntax for this is somewhat different. | You can use | | [(a, b-a) | b <- [1..], a <- [1..b-1]] Or: [ (a,b) | (a,b) <- [1..] // [1..] ] For a suitable definition of (//), for example: (//) :: [a] -> [b] -> [(a,b)] xs // ys =

RE: Deriving Enum

1999-07-11 Thread Mark P Jones
| To me, it seems unsatisfactory to have a solution to this pure | list problem with auxiliary functions relying on integers. | It turns out to be a nice exercise to implement | | > diagonalise :: [[a]] -> [a] | | without any reference to numbers. Here's my definition of an integer free diagon