Re: [Haskell-cafe] Flagstone problem

2010-11-06 Thread Brent Yorgey
On Thu, Nov 04, 2010 at 10:50:06AM -0700, michael rice wrote: Hi, I've been looking at a flagstone problem, where no two adjacent n-tuples can be identical. I solved the problem with Icon using Interesting stuff! = Here's my Haskell code import Data.Bits import

Re: [Haskell-cafe] Flagstone problem

2010-11-06 Thread michael rice
...@seas.upenn.edu Subject: Re: [Haskell-cafe] Flagstone problem To: haskell-cafe@haskell.org Date: Saturday, November 6, 2010, 7:03 AM On Thu, Nov 04, 2010 at 10:50:06AM -0700, michael rice wrote: Hi, I've been looking at a flagstone problem, where no two adjacent n-tuples can be identical. I

Re: [Haskell-cafe] Flagstone problem

2010-11-06 Thread Alexander Solla
On Nov 6, 2010, at 4:03 AM, Brent Yorgey wrote: Doesn't make much sense to me. The sum of binary digits in the binary representation of n will not be zero very often... I think they mean the sum (mod 2) when they say the sum of binary digits. That should be zero half the time.

Re: [Haskell-cafe] Flagstone problem

2010-11-06 Thread michael rice
Hi, Alexander Your change produces the same sequence of 0s, 1s, and 2s. mod n 2 == fromEnum (even n) Michael --- On Sat, 11/6/10, Alexander Solla a...@2piix.com wrote: From: Alexander Solla a...@2piix.com Subject: Re: [Haskell-cafe] Flagstone problem To: Cc: haskell-cafe Cafe haskell-cafe

[Haskell-cafe] Flagstone problem

2010-11-04 Thread michael rice
Hi, I've been looking at a flagstone problem, where no two adjacent n-tuples can be identical. I solved the problem with Icon using an array of stacks and was going to explore how to do it in Haskell when I saw another way to do it explained in the same text. Just count the ones between the zeros