[Haskell-cafe] type Rational and the % operator

michael rice nowgate at yahoo.com
Sat Mar 28 21:39:26 EDT 2009

I've been away from Haskell Land for a while, but I think the function cf below, given a list of Ints should calculate a continuous fraction. I'm using Hugs 98 and get errors when loading and also when trying to use the % operator at the command prompt (see below). What must I do to get this to work?



cf :: [Int] -> Rational
cf [] = 0

cf (x:[]) = 1 % x

cf (x:xs) = x + (1 % cf xs)

Hugs> :load cf.hs
ERROR "cf.hs":2 - Undefined variable "%"

Hugs> 1 % 5
ERROR - Undefined variable "%"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090328/fdfaab9a/attachment.htm

More information about the Haskell-Cafe mailing list