Re: Position of arguments in function definition and performance

2002-02-06 Thread Hal Daume III
Actually, presumably you meant: > reverse2 ys (x:xs) = reverse2 (x:ys) xs (stupid cut & paste late at night). with this fix (and now we actually are reversing the list with reverse2), we get the following timings for reverse2: 11:49pm enescu:~/ time a.out 200 4.64u 0.31s 0:05.18 95.5% 11:49

Re: Position of arguments in function definition and performance

2002-02-06 Thread Hal Daume III
Well, I assume you meant: reverse1 [] ys = ys reverse1 (x:xs) ys = reverse1 xs (x:ys) reverse2 ys [] = ys reverse2 ys (x:xs) = reverse1 (x:ys) xs If so, and you make two programs: main = print (length $! reverse1 [1..200] []) and main = print (length $! reverse2 [] [1..200]) compile

joining

2002-02-06 Thread ilje
Hi. I want to join please. thanks in advance. Ilan.  

Re: Reference types

2002-02-06 Thread Ashley Yakeley
At 2002-02-06 03:38, John Hughes wrote: >Well, I'm still not convinced. A reference *value* can't have the type > > (LiftedMonad (ST s) m) => Ref m a Oh, yeah, you're right. I made a mistake here: newSTRef :: a -> Ref (ST s) a; newSTLiftedRef :: (LiftedMonad

Position of arguments in function definition and performance

2002-02-06 Thread José Romildo Malaquias
Hello. Please, tell me which set of definitions below should I expected to be more efficient: the reverse1 or the reverse2 functions. reverse1 [] ys = ys reverse1 (x:xs) ys = reverse2 (x:ys) xs reverse2 ys [] = ys reverse2 ys (x:xs) = reverse2 (x:ys) xs The difference rely on the posit

PhD Fellowship in Valencia, Spain

2002-02-06 Thread Maria Alpuente
DOCTORAL RESEARCH GRANT Extensions of Logic Programming and Formal Methods ** The Department of Software of the Technical University of Valencia UPV (Spain), offers one research scholarship to pursue a Ph.D. degree in the Extensions of

Re: Reference types

2002-02-06 Thread John Hughes
Ashley Yakeley wrote: At 2002-02-06 01:09, John Hughes wrote: >No no no! This still makes the reference type depend on the monad type, which >means that I cannot manipulate the same reference in two different monads! Yes you can. Consider: -- m some

Re: Reference types

2002-02-06 Thread Ashley Yakeley
At 2002-02-06 00:54, Koen Claessen wrote: >You are completely right, of course I meant r -> m! Right. There's the equivalent of an r -> m dependency because m is a parameter in the Ref type constructor. But it doesn't matter, because you can create values of this type: myIntRef :: (MyMon

Re: Reference types

2002-02-06 Thread Ashley Yakeley
At 2002-02-06 01:09, John Hughes wrote: >No no no! This still makes the reference type depend on the monad type, which >means that I cannot manipulate the same reference in two different monads! Yes you can. Consider: -- m somehow uses 'rep' internally class (Monad rep, Monad m) => Lif

Re: Reference types

2002-02-06 Thread John Hughes
John Hughes despaired: | Oh no, please don't do this! I use the RefMonad class, | but *without* the dependency r -> m. Why not? Because | I want to manipulate (for example) STRefs in monads | built on top of the ST monad via monad transformers.

Re: Reference types

2002-02-06 Thread Ashley Yakeley
At 2002-02-06 00:33, Koen Claessen wrote: >Hm... this looks nice. With slight name changes this >becomes: Oh if you must. I decided that Refs were _so_ fundamental that anytime you get, set or modify anything it could probably be represented as a Ref, so the functions merit highly generic name

Re: Reference types

2002-02-06 Thread Koen Claessen
John Hughes despaired: | Oh no, please don't do this! I use the RefMonad class, | but *without* the dependency r -> m. Why not? Because | I want to manipulate (for example) STRefs in monads | built on top of the ST monad via monad transformers. | So I use the same reference type with *many d