I'm a Lisper, kind of feeling my way around here in Haskell, so please bear with me. I did the things you suggested, but I think the last one may have gotten garbled. Anyway, this is what I ended up with cf2 :: Rational -> [Int] cf2 a = let ai = floor a in if a == (toRational ai) then [ai] else ai : cf2 (1 / (a - ai)) but I'm still at least one error short of a clean run Main> :load cf.hs ERROR "cf.hs":7 - Type error in application *** Expression : ai : cf2 (1 / (a - ai)) *** Term : ai *** Type : Ratio Integer *** Does not match : Int Where did I go wrong or what did I leave out? Michael --- On Sun, 3/29/09, Lennart Augustsson <lennart@augustsson.net> wrote:
|