Re: [Haskell-cafe] Hamming's Problem

2008-01-22 Thread Bertram Felgenhauer
I wrote: > merge' (x:xs) ys = x : merge xs ys > > hammingx = 1 : foldr1 merge' [map (h x) hammingx | x <- hammingx] Sorry. 'foldr1' is still slightly too strict. (Why doesn't the Haskell report define foldr1 in terms of foldr?) The code that works is marge' [] ys = ys merge

Re: [Haskell-cafe] Hamming's Problem

2008-01-21 Thread Bertram Felgenhauer
Jose Luis Reyes F. wrote: > Thanks for your help, I tried to solve the problem this weekend but I have > some dudes. > > My reasoning is: > > The sequence is [1,a1,a2,a3,..] where a1 = h 1 1, a2 = h 1 a1, and so on > > So, I want to construct the list of lists > [[1,a1,a2,a3], > [h 1 1, h 1 a1,

RE: [Haskell-cafe] Hamming's Problem

2008-01-21 Thread Jose Luis Reyes F .
aje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de Bertram Felgenhauer Enviado el: viernes, 18 de enero de 2008 8:36 Para: haskell-cafe@haskell.org Asunto: Re: [Haskell-cafe] Hamming's Problem Jose Luis Reyes F. wrote: > Hi, > > In exercise 2 of http://www.wa

Re: [Haskell-cafe] Hamming's Problem

2008-01-18 Thread Dougal Stanton
On 18/01/2008, Bertram Felgenhauer <[EMAIL PROTECTED]> wrote: > I have some ideas, but maybe you want to work on a correct solution > first? There is an implementation on the wikipedia article for Haskell: hamming = 1 : map (2*) hamming `merge` map (3*) hamming `merge` map (5*) hamming wher

Re: [Haskell-cafe] Hamming's Problem

2008-01-18 Thread Bertram Felgenhauer
Jose Luis Reyes F. wrote: > Hi, > > In exercise 2 of http://www.walenz.org/Dijkstra/page0145.html we need to > write a function that holds > > (1)The value 1 is in the sequence > (2)If x and y are in the sequence, so is f(x,y), where f has the > properties > a. f(x,y) > x > b. (y

Re: [Haskell-cafe] Hamming's Problem

2008-01-17 Thread Calvin Smith
The author of Pugs (Perl6 implemented in Haskell) gives a nice solution to the problem of generating the Hamming numbers in the following interview: http://www.perl.com/pub/a/2005/09/08/autrijus-tang.html?page=last ___ Haskell-Cafe mailing list Haskell-C