[Haskell-cafe] type Rational and the % operator

Duane Johnson duane.johnson at gmail.com
Sat Mar 28 21:44:57 EDT 2009


I believe it's

> import Data.Ratio

I found it on hayoo... http://holumbus.fh-wedel.de/hayoo/hayoo.html?query=%25#0 
:%25

-- Duane Johnson

On Mar 28, 2009, at 7:39 PM, michael rice wrote:

> 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>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

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


More information about the Haskell-Cafe mailing list