On Sun, 2007-04-01 at 16:46 -0400, Paul Hudak wrote: > Here's a solution that I think is a bit more elegant. > > -Paul > > josephus n k = > let loop xs = let d:r = drop (k-1) xs > in d : loop (filter (/= d) r) > in take n (loop (cycle [1..n]))
Lovely. .. must.. resist ... urge to fuse ... Actually the interesting thing that makes this example tricky to fuse using automagic techniques is that while loop looks like it should be a good producer and consumer, it's also recursive. Hmm, interesting. Duncan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe