[Haskell-cafe] type Rational and the % operator

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


Hi,
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?

Michael

===============

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> 

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






      
-------------- 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