On 2009 Mar 29, at 16:19, michael rice wrote:
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?

cf2 returns [Int], but you're using it as the tail of a list starting with ai, which is a Rational. Need to decide which you actually want. At a guess:

> cf2 a = let ai = floor a
>             rai = toRational ai
>          in
>             if a == rai
>             then [ai]
>             else rai : cf2 (1 / (a - ai))

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to