Homework

Joe English jenglish@flightlab.com
Fri, 22 Aug 2003 12:55:33 -0700


thomas_bevan wrote:
>
> Seeing as its thst time of year again and everyone is posting their
> homework, has anyone got any good puzzles to do?
> I wouldn't mind having a go at something a bit tricky.

Here's one: figure out what the following does :-)

puzzle = (!!) $ map (1:) $ iterate (s (lzw (+)) (1:)) [] where
    s f g x = f x (g x)
    lzw op xs [] = xs
    lzw op [] ys = ys
    lzw op (x:xs) (y:ys) = op x y : lzw op xs ys


(No fair trying it out in Hugs first...)

--Joe English

  jenglish@flightlab.com