Re: type of (/) ?

2003-12-09 Thread Fergus Henderson
On 09-Dec-2003, Yaroslav Korchevsky <[EMAIL PROTECTED]> wrote: > > my_avg list = (accum list) / 5 --works fine > > xx = 5 > my_avg list = (accum list) / xx --doesn't work > -- same message as above > ===

Re: Preventing/handling space leaks

2003-12-09 Thread ajb
G'day all. Quoting Gabriel Dos Reis <[EMAIL PROTECTED]>: > I think it is fair to characterize auto_ptr as a curiously broken > class since its conception and design. I also think that's a fair characterisation. std::auto_ptr has always struck me as a fairly brittle abstraction. Learning that i

Re: Multiple functions applied to a single value

2003-12-09 Thread Brandon Michael Moore
Control.Monad.Reader defines instances of Monad and MonadReader for ((->) r). Strangely enough, the documentation claims the Monad instance comes from Control.Monad, which is untrue. Here's the relevant chunk of the file. It looks like you came up with exactly the same code (modulo names). -- -

Re: type of (/) ?

2003-12-09 Thread Christian Maeder
Yaroslav Korchevsky wrote: my_avg list = (accum list) / (length list) ERROR "U:\slav\FP\Avg.hs":11 - Type error in application *** Expression : accum list / length list *** Term : accum list *** Type : Float *** Does not match : Int Why "

Re: type of (/) ?

2003-12-09 Thread Hal Daume III
> ERROR "U:\slav\FP\Avg.hs":11 - Type error in application > *** Expression : accum list / length list > *** Term : accum list > *** Type : Float > *** Does not match : Int > > Why "accum list" should match to "Int"? > When I try to replace (length list) with number - it w

type of (/) ?

2003-12-09 Thread Yaroslav Korchevsky
I have been trying Hugs98   This is the average of floats list calculation program:   accum :: [Float] -> Floataccum list = foldr (+) 0 list   my_avg list =  (accum list) / (length list)   While loading it I got the compiler m

Re: Preventing/handling space leaks

2003-12-09 Thread Gabriel Dos Reis
Fergus Henderson <[EMAIL PROTECTED]> writes: | Even the C++ standard library itself, which has been | subject to review by the world's best C++ experts, suffers | from exception safety problems. A new exception safety | problem with std::auto_ptr was discovered just last Friday! See |

Re: Multiple functions applied to a single value

2003-12-09 Thread Derek Elkins
On Mon, 08 Dec 2003 16:33:53 + Graham Klyne <[EMAIL PROTECTED]> wrote: > A little while ago, I sent a long rambling message [1] containing a > key question in response to an earlier helpful response. I guess my > ramblings were quite reasonably passed over as too much waffle, and > the questi

Re: Multiple functions applied to a single value

2003-12-09 Thread Graham Klyne
A little while ago, I sent a long rambling message [1] containing a key question in response to an earlier helpful response. I guess my ramblings were quite reasonably passed over as too much waffle, and the question was lost. Here, I isolate the question. From the earlier response, I underst

RE: Common subexpressions are not optimized to single one?

2003-12-09 Thread Simon Marlow
> I'm wondering about the optimization of ghc. I thought that since > functions are pure in haskell, compiler can/do factorize common > subexpressions when it optimizes a code. But the result of > the following > experiment looks negative; "g 10 100" is caluculated twice. > > Am I missing som

Re: Preventing/handling space leaks

2003-12-09 Thread Fergus Henderson
On 08-Dec-2003, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > G'day all. > > Quoting Sven Panne <[EMAIL PROTECTED]>: > > > Granted, C++'s (copy) constructors, destructors and assignment operators > > make some things relatively easy compared to C, but the complexity of > > handling exceptions *c