Re: [Haskell-cafe] casting numerical types

2006-04-02 Thread Matthias Fischmann
Ok. I was hoping that there was a common ancestor of Integral and Fractional. Now I realize that I can be more precise about what I wanted: avg :: (FractionalOrIntegral a) = [a] - a avg xs = sum (map fromFractionalOrIntegral xs) / (fromIntegral (length xs)) But although it there may be

Re: [Haskell-cafe] casting numerical types

2006-04-02 Thread Malcolm Wallace
Matthias Fischmann [EMAIL PROTECTED] writes: avg :: (FractionalOrIntegral a) = [a] - a avg xs = sum (map fromFractionalOrIntegral xs) / (fromIntegral (length xs)) Your condition is probably too strong. For one thing, there is no need to convert every element of the list being summed,

Re: [Haskell-cafe] casting numerical types

2006-04-02 Thread Matthias Fischmann
On Sun, Apr 02, 2006 at 10:53:02AM +0100, Malcolm Wallace wrote: To: haskell-cafe@haskell.org From: Malcolm Wallace [EMAIL PROTECTED] Date: Sun, 2 Apr 2006 10:53:02 +0100 Subject: Re: [Haskell-cafe] casting numerical types Matthias Fischmann [EMAIL PROTECTED] writes: avg ::

[Haskell-cafe] PPM image manipulation

2006-04-02 Thread newb
having some trouble trying to be able to manipulate PPM images. I want to be able to desaturate and also double the scale of them. im a first time user of haskell so am not very familiar with it. any info would be great! thanks! -- View this message in context:

Re: [Haskell-cafe] PPM image manipulation

2006-04-02 Thread Jared Updike
having some trouble trying to be able to manipulate PPM images. I want to be able to desaturate and also double the scale of them. im a first time user of haskell so am not very familiar with it. any info would be great! thanks! Nothing wrong with asking for help, but before you do, please

[Haskell-cafe] Distributing monadic(?) functions across dyadic functions

2006-04-02 Thread Jared Updike
Is there a common way (standard libs, higher order) to express the lambda part below? It's not particulary complicated but I think it is not higher-order enough unionBy (\x y - fst x == fst y) listOfPairs1 listOfPairs2 Something like distribute fst (==) where distribute f op x y = f x `op` f

Re: [Haskell-cafe] Distributing monadic(?) functions across dyadic functions

2006-04-02 Thread David Menendez
Jared Updike writes: Is there a common way (standard libs, higher order) to express the lambda part below? It's not particulary complicated but I think it is not higher-order enough unionBy (\x y - fst x == fst y) listOfPairs1 listOfPairs2 Something like distribute fst (==) where

Re: [Haskell-cafe] Distributing monadic(?) functions across dyadic functions

2006-04-02 Thread Dean Herington
At 11:58 AM -0700 4/2/06, Jared Updike wrote: Is there a common way (standard libs, higher order) to express the lambda part below? It's not particulary complicated but I think it is not higher-order enough unionBy (\x y - fst x == fst y) listOfPairs1 listOfPairs2 Something like distribute

Re: [Haskell-cafe] Off-topic [was: Distributing monadic(?) functions across dyadic functions]

2006-04-02 Thread Daniel McAllansmith
On Monday 03 April 2006 08:09, David Menendez wrote: If you look at it in terms of folds over pairs, cata () (x,y) = x y -- corresponds to uncurry ana f g x = (f x, g x) -- corresponds to () Then you can de-forest: hylo () f g x = f x g x -- hylo () f g == cata

Re: [Haskell-cafe] PPM image manipulation

2006-04-02 Thread newb
its ok got it all sorted now :) -- View this message in context: http://www.nabble.com/PPM-image-manipulation-t1382306.html#a3717745 Sent from the Haskell - Haskell-Cafe forum at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org