Re: Haskell 98

1999-07-12 Thread Antti-Juhani Kaijanaho
On Mon, Jul 12, 1999 at 07:48:30AM -0700, Simon Peyton-Jones wrote: > Who owns the copyright? Technically, everybody who has contributed nontrivial amounts of text (not ideas, but text). > but given very free-wheeling permission to reproduce the report. I have one request. Language definitio

Re: diagonalisation

1999-07-12 Thread Wolfram Kahl
Stefan Kahrs <[EMAIL PROTECTED]> writes: > I liked Mark's version, but let me add a related challenge. > > I defined a translation of //-list comprehensions > that is analogous to the foldr-translation of list comprehensions > (which optimises the map-concat approach) but works in the infin

RE: Deriving Enum

1999-07-12 Thread Tom Pledger
Tom Pledger writes: | > diag = foldr (diag2 []) [[]] where | > diag2 zs (x:xs) ys = (zipWith (:) (x:zs) ys) ++ diag2 (x:zs) xs ys | > diag2 zs [] (_:ys) = (zipWith (:) zs ys) ++ diag2 zs [] ys | > diag2 _ _ _ = [] ... which hangs when given a mixture of empty and

RE: Deriving Enum

1999-07-12 Thread Tom Pledger
Wolfram Kahl writes: | 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. IIRC a (Cantor?) diagonal

Diagonalisations (was: Re: Deriving Enum)

1999-07-12 Thread Wolfram Kahl
In the meantime I have discovered a flaw in my original diagonalisation in that it looped in finite cases. This can easily be mended: DiagWK1: > diag :: [[a]] -> [a] > diag = f id where > f :: ([[a]] -> [[a]]) -> [[a]] -> [a] > f a [] = split id (a []) [] > f a (l:ls) = split id (a [l]) ls

diagonalisation

1999-07-12 Thread S.M.Kahrs
I liked Mark's version, but let me add a related challenge. I defined a translation of //-list comprehensions that is analogous to the foldr-translation of list comprehensions (which optimises the map-concat approach) but works in the infinite case as well. This requires an operator foldrinf, o

re: diagonalisation

1999-07-12 Thread Colin . Runciman
Another alternative to diag [[f x y | x < - xs] | y <- ys] is to write it as diagWith f xs ys where: diagWith f [] ys = [] diagWith f xs [] = [] diagWith f (x:xs) ys = d [x] xs ys where d xs' xs ys = zipWith f xs' ys ++ d' xs ys where d' [] [] = [] d' [] (y:ys)

RE: Deriving Enum

1999-07-12 Thread Frank A. Christoph
> > > Miranda has something called diagonalizing list > > comprehensions if I recall > > > correctly. I think you would write: > > > > > > [(a,b) // a <- [1..], b <-[1..]] > > > > > > and the resulting list would be > > > > > > [(1,1), (1,2), (2,1) ...] > > > > Haskell has this too. :) The s

Re: Deriving Enum

1999-07-12 Thread Wolfram Kahl
Mark P Jones <[EMAIL PROTECTED]> writes: > > Here's my definition of an integer free diagonalization function. > [..] As written, I think > it is a nice example of programming with higher-order functions, > and, in particular, using function composition to construct a > pipelined program:

RE: Diagonalisations (was: Re: Deriving Enum)

1999-07-12 Thread Simon Peyton-Jones
> DiagMPJ 0:00.16 0:02.32 0:37.55 > DiagMPJ1 0:00.12 0:01.50 0:23.83 > DiagWK1 0:00.12 0:01.34 0:19.02 > DiagWK2 0:00.12 0:01.35 0:19.09 > DiagWK3 0:00.12 0:01.34 0:18.82 > > > The only thing that surprises me is > that the compiler does not do the optimization from DiagWK2

Haskell 98

1999-07-12 Thread Simon Peyton-Jones
Folks, For a long time an item on my to-do list has been to update the Haskell 98 bugs page. http://research.microsoft.com/~simonpj/haskell/haskell98-bugs.html I have now done so, adding a dozen or so bug fixes and clarifications that have arisen over the last few months. I believe t