On 17 Sep 2002, Jan Kybic wrote: > > > > collection. I want to try to force l to be generated on-the-fly > > > > every time it is needed, to see if it improves performance. > > > > What is a good way to do it? Would something like > > > > > > ... > > > The easiest way is to make it a function > > > > > > l _ = [ i*i*i | i <- [0..n] ] -- for very large n > > > > > > I asked a similar question a while ago, and (I think) there was general > > agreement that this was not a reliable solution because the expression
Note that (assuming that I'm not missing something) you can prevent the moving of expressions involving l in a very ugly way by noting that these `dummy argument functions' are polymorphic so that you could write x1 = f1 (l 1) x2 = f2 x1 (l 2) x3 = f3 x2 (l 3) (ie using a different argument for each one) since I'm pretty sure none of the Haskell compilers attempt to replace an lhs by an rhs before attempting lambda lifting. The nasty thing about this is of course that the onus is now on you to ensure you don't repeat an argument; you don't get any help from the type system. ___cheers,_dave_________________________________________________________ www.cs.bris.ac.uk/~tweed/ | `It's no good going home to practise email:[EMAIL PROTECTED] | a Special Outdoor Song which Has To Be work tel:(0117) 954-5250 | Sung In The Snow' -- Winnie the Pooh _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
