I’ve been messing around with Atom this morning and found your post. The links to the source files seem to be broken, could you fix/provide working ones? I’ve reconstructed some of the source from copy-pasting but seem to be missing some pieces :)

Thanks,

Michael

Thanks! You’re right. I wasn’t thinking of formally deriving the Atom specification from the Haskell, but yours is closer. By the way, in terms of efficiency, your version or even

`fib :: Int -> Int`

fib n = fibs !! n

fibs = 1 : 1 : [ x + y | (x,y) <- zip fibs (tail fibs) ]

is more efficient (but yours is a better specification for the Atom implementation).

]]> fib n = fst $ fibHlp n (1,1)

where

fibHlp :: Int -> (Int,Int) -> (Int,Int)

fibHlp 0 p = p

fibHlp n (a,b) = fibHlp (n-1) (b, a+b)