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
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,
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 ::
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:
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
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
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
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
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
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
10 matches
Mail list logo